CS552 Assignment 4 ("fun" and games)

Start on this one right away, because this can be time-consuming to debug. It's probably going to seem a little weird, but after you work through it, you'll have prepared yourself for an essential aspect of the project.

Your assignment is to make the web server play the "guess the number game" with the user. This game goes like as follows:

  1. The computer thinks up a number between 1 and 100.
  2. The player guesses a number.
  3. If the player's number is the computer's number, the computer says "You got it" and the game is over. Otherwise the computer says "Nope, that's not it" and invites the user to guess another number.
  4. The player guesses another number.
  5. If that number is the computer's number, the computer says "You got it" and game is over.
  6. The computer says "you're getting warmer" if this guess was closer than the previous guess. Otherwise, the computer says "you're getting colder." In any case, the computer invites the player to guess another number.
  7. Go back to step 4.
  8. At any stage, the player may get bored and decide to go watch a movie instead of playing stupid games.

The constraints:

Hints: