We are going to assume that you are comfortable with how the code provided in the previous section works. Here's the script again:
Here are six challenges to try to make the code act more like a human. If you think of anything else that would make it cooler, feel free to add it in. Try each of these in order. When you are done, your finished code should be able to deal with all of the challenges.
Challenge #1: The sprite should welcome the player and ask for their name before beginning.
Challenge #2: If they guess incorrectly, the sprite should tell them that they are incorrect, using their name. For example, if Colleen is playing the game, the sprite should say something like
Sorry Colleen, that is not the right answer. before asking them to
Challenge #3: If they guess incorrectly, the sprite should tell them if the secret number is bigger or smaller than the number that they guessed.
Challenge #4: Right now, the script always picks a number between
10. Change this so that it picks a number between
1 and a variable
maximum. Ask the player what they would like the maximum number to be, before
choosing a random number. Use this maximum number as the highest number that the script will
Challenge #5: Keep track of how many guesses it takes before the player guesses the right number.
Challenge #6: When the player guesses the secret number, tell them how many guesses it took, and congratulate them using their name.