CIT 597 Assignment 7: Guess My Number
Fall 2007, David Matuszek

Purposes of this assignment:

General idea of the assignment:

"Guess my number" is one of the oldest, and still one of the dumbest, computer games. I think it was invented to teach the concept of binary search. It goes something like this:

Computer: I'm thinking of a number between 1 and 100. Guess what it is.
Human: 50
Computer: No, that's too low. Guess again.
Human: 75
Computer: No, that's too high. Guess again.
Human: 65
Computer: No, that's too low. Guess again.
Human: 70
Computer: No, that's too low. Guess again.
Human: 73
Computer: That's right! You guessed my number in only 5 tries! Would you like to play again?

In this modern, hi-tech version of the game, the "Computer" will be played by the part of a Java servlet. It will choose a random number between 1 and 100 (inclusive) for each player. It will use session tracking so that it can play multiple simultaneous games with different users; it will keep track of the number of guesses in each game; and it will use JSP to hold up its side of the conversation.

It would be nice to ask for the user's name on the initial (static) HTML page, then use it in the interaction. ("No, John, that's too low....")

The secret number should be kept only on the server, not hidden in the HTML.


Tomcat. Servlets. Java Session Tracking API. JSP. Need I say more?

Due date:

Monday, November 12, before midnight. Zip the folder containing your "complete program" (I'll be more specific later about just what that means) and submit via Blackboard.