# Lab 3โฃ.0โฃ Guessing Game

In this lab, you will use conditional statements and variables to build a simple number guessing game.

## Section 1 - Iโm Thinking of a Numberโฆ

You will write a SNAP program to choose a random number between 1 and 10 and then ask the user to guess a number.

If the userโs guess matches the random number, the user wins. If not, the user loses. In either case, the user should be shown a message indicating whether she won or lost and the secret random number should be revealed.

• Write the simple version of the guessing game program described above.
• Modify the program to keep asking the user for guesses until the correct number is given. Be sure to give a message after each guess, but only reveal the secret number when the user has guessed correctly and the game is over.
• Add code to ask the player their name at the start of the game. Then, personalize the message for an incorrect guess by adding the playerโs name. For example, if Scout is playing the game, then the message should say โSorry, Scout, that guess is not correctโ instead of just โSorryโ when Scout guesses incorrectly.

## Section 2 - Game Upgrades

• Modify your guessing game so that the player can decide the range of possible numbers from which the secret number can be chosen. After asking the playerโs name, ask what she wants the highest possible number to be. Then, instead of choosing a random number between 1 and 10, choose a random number between 1 and the number the player requested.
• Add code to keep track of how many guesses the player has made. After the player guesses correctly, inform her how many tries it took before the correct number was guessed.
• Increase the playerโs chances by telling her whether the guessed number is too high or too low instead of just that it is incorrect.