-
Notifications
You must be signed in to change notification settings - Fork 2
/
guessing-game.rb
19 lines (18 loc) · 1.16 KB
/
guessing-game.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Challenge: Guessing Game
# This challenge is comprised of creating a guessing game,
# First, the user will be asked for their name.
# Use Ruby input to get the name and say hello to the user as well as explain the rules.
# These are that a random number (between 1 and 10) is going to be picked and the user will have to guess it.
# Let the player know if the guess is correct or not.
# Let the user guess three times then reveal the number.
# If the player loses let the user know it was their last guess.
# If the player wins display a message that their guess was correct.
# Hint: The rand method needs to be used, pass a number to generate a random number.
# rand(100) will generate a number from 0 to 99.
# Extensions
# Scripts can be extended to allow new functionality.
# Ask players up to what number they want to guess. Instead of guessing from 0 to 10, could be up to whatever the player chooses.
# Check the validity of that number, making sure it is not a string or an array.
# Allow more guesses based on the maximum number the user chooses.
# Inform the player if they're getting close (warm/cold).
# Inform the player if they're too high or too low on each attempt.