Classroom Programming
page was last updated: Sep 01, 2017 02:03
forum
Guessing Game P1

Requirements

Objective

  1. Generate a random number
  2. Restartable when game is over
  3. Listen for input and handle it
  4. Handle trash input
  5. Bonus
    1. Press q as a guess to stop immediately
    2. Limited number of guesses

Simple, a game where the game automatically picks a random number, let's say 1-100. The user has to guess what the number is and the program responds with "youre getting colder/hotter". Which means, first guess obviously won't say this. When guessed, the game displays how many guesses it took and whether he would like to play again.

Example

Guessing game! First guess?: 5 Nope, guess: 42 You're getting colder. guess: 25 You're getting warmer. guess: 23 Correct! Play again? (y/n): n |