Skip to content

Latest commit

 

History

History
141 lines (108 loc) · 4.33 KB

games_guessing_game.livemd

File metadata and controls

141 lines (108 loc) · 4.33 KB

Games: Guessing Game

Mix.install([
  {:jason, "~> 1.4"},
  {:kino, "~> 0.9", override: true},
  {:youtube, github: "brooklinjazz/youtube"},
  {:hidden_cell, github: "brooklinjazz/hidden_cell"}
])

Navigation

Games: Guessing Game

In your existing Games project, you're going to create a number guessing game which accepts user input through the command line.

You should be able to start your project by running the following from the game folder in the command line.

iex -S mix

Then you can start the game with the Games.GuessingGame module.

Games.GuessingGame should prompt the user to guess a number between 1 and 10.

iex> Games.GuessingGame.play()
Enter your guess:

If the guess is correct, return a winning message.

Enter your guess: 10
Correct!

if the guess is incorrect, return a failing message.

Enter your guess: 10
Incorrect!

Bonus: Re-Attempt

If the guess is incorrect, re-prompt the user to enter another guess until they succeed.

Enter your guess: 10
Incorrect!
Enter your guess: 5
Incorrect!
Enter your guess: 7
Correct!

Bonus: High Or Low!

If the guess is too high or low, prompt the user with informative feedback.

Enter your guess: 10
Too High!
Enter your guess: 5
Too Low!
Enter your guess: 7
Correct!

Commit Your Progress

DockYard Academy now recommends you use the latest Release rather than forking or cloning our repository.

Run git status to ensure there are no undesirable changes. Then run the following in your command line from the curriculum folder to commit your progress.

$ git add .
$ git commit -m "finish Games: Guessing Game exercise"
$ git push

We're proud to offer our open-source curriculum free of charge for anyone to learn from at their own pace.

We also offer a paid course where you can learn from an instructor alongside a cohort of your peers. We will accept applications for the June-August 2023 cohort soon.

Navigation