This module is responsible for playing one round of the game. We will further divide this module into two parts:
The Sequence Module:
This module is responsible for sequencing the steps of play for one round of the game.
The Test Module:
This module is responsible for testing the user guess and giving the appropriate feedback.
The Sequence Module Algorithm:
This module is responsible for sequencing the steps of play for one round of the game.
Given: the random number, Return: win or lose
1. Initialize the number of guesses
2. while there are guesses remaining
a. ask the player to guess
b. if the guess is correct
return a winner!
c. otherwise give the hint
d. update the number of guesses
3. Return a loser :-(
The Test Module Algorithm: This module is responsible for testing the user guess and giving the
appropriate feedback.
Given: the pick and the guess, Return: win, high, or low
1. If the guess matches the pick
return win!
2. Otherwise if the guess is too low
return low!
3. Otherwise if the guess is too high
return high!