Hot or Cold: Guess the Number

Can you guess the mystery number?!? It's between 0 and 100.

1) Choose a backdrop and a character to host the game.

2) Have your host intoduce the game and explain what this game is about. "I have a mystery number between 0 and 100. Can you guess what it is?" Remember to make sure the player has a space to enter their guess and start playing.

3) Make the mystery number!

4) When the player tries to guess the mystery number, check if their answer is a number between 0 and 100. If it isn't, remind the player of the rules. If it is, check if the answer is the same as as the mystery number.

If the guess is equal to the mystery number, celebrate! Else, ask the player to try again.

5) Let's keep track of the player's guesses by creating a list. If the player repeats a guess, let them know they've guessed it already. Else, add the answer to the list. Make sure to add the correct answer to the list as well.

6) Can we make the host tell the player how many tries it took for them to guess the mystery number? We can use the length of the list to construct the response. ;-)

7) It's time to give our player feedback on how far their guess is from the mystery number. Let's start by calculating the difference between the guess and the mystery number.

Hint: Use the absolute value of the difference to measure how far off the guess is. The block you're looking for is in "Operators".

8) If the difference between the guess and the mystery number is less than 5, tell the player that the guess is "HOT!" If the difference is between 5 and 10, tell the player that the guess is "WARM!" Else, tell the player that the guess is "COLD!"

You can give as much feedback as you'd like. The example uses Hot, Warm, Luke Warm, Tepid, Cold, and Ice Cold to help players guess the right number.

9) Let's clean up our code. The player should never see the mystery number and the difference. The list should be hidden until someone makes a guess.

Are you satisfied? Let's tell our player to click the green flag to play again.