**The first task **for each student is to write a program where the computer thinks of a number, and the student gets to guess the number (and the program says if the guess is too high, too low, or just right). The program keeps soliciting the user for a guess until the correct answer has been provided. On the TI-83, to have the computer pick a number from 1 to 1000, you use the random number generator under Math->Prb->randInt. The following line of code is how the Ti-83 picks a number from 1 to 1000, and stores it into the variable A:

randInt(1,1000) -> A

I will leave the rest of the program writing to you. You’ll use Lbl, if, Input, math tests (>, <) and Disp.

I originally got the idea for a number guessing program when I was 12. I got it from the book, *Basic Computer Games*. This book made quite an impression upon me, so it is a pleasure to pass along a snippet (click on the image below to see page 75):

**The second task **for the student is to think of the best way to guess numbers. For example, consider that I am thinking of a number from 1 to 1000, and I ask you to guess that number (and I will tell you if you are too high or too low). Two bad ways to go about guessing would be to begin at one and count up to 1000 till you got it, or to begin and 1000 and count down. There must be a better way. Find that way. And then come up with a statement that will tell me the most number of guesses it would take for a person to figure out the secret number.

Do the same thing as if the number to be guessed is between 1 and 10.

Then do it again for a number between 1 and 100. Then 1 and 1000. Can you find a general pattern that will tell you the maximum number of guesses it would take to find the hidden number for any range?

**Bonus Assignment**: This following line of thinking was not covered in our last class. But consider what it would be like to play the game of Guess in reverse… bear with me, and I’ll try to explain. Imagine that instead of randomly picking a number, the computer randomly picks “too high” or “too low” at each guess. That is, the computer itself does not know the secret number, but discovers it with the guesser. Can any number be written as a sequence of “too high” and “too low” statements? Don’t worry if this *Bonus Assignment* makes no sense. But if you follow the gist, have fun thinking about it. And welcome to the world of open-ended questions.