Program 6, High Low.

Short Description:

Write a program which will play an interactive guessing game.

This assignment is worth 50 points.

Goals

When you finish this homework, you should:

Formal Description

Write a program which will play a game of high/low with a user. Your program should be able to play either roll in this game.

A game of high low is a two player game where the first player thinks of a number between 1 and 100, and the second play attempts to guess that number. A single round consists of the second player providing a guess and the first player stating if the guess is too high or too low. Play continues until the second player guesses the correct number.

A typical session where the computer is player 1 might look like this:

I am thinking of a number between 1 and 100.  Try to guess the number:
Enter guess 1 (between 0 and 101)  => 23
23 is too low.  Try again!

Enter guess 2 (between  23 and 101) => 98
98 is too high.  Try again!

Enter guess 2 (between  23 and 98) =>
...

Enter guess 12 (between 50 and 52) => 51 
51 is correct.
Congratulations you guessed the right number in 12 tries.
Thank you for the fun game.

A typical session where the player is player 1 might look like this.
Think of a number between 1 and 100.   
Type yes when you have a number => bob
I don't understand bob.

Type yes when you have a number => yes

Good, I will try to guess your number.  

Guess 1.  I know your number is between 0 and 101.
Is your number 50? (yes or no) => no
Is 50 too high or too low (high or low) => high
Very good.  50 is too high.

Guess 2.  I know your number is between 0 and 50.
Is your number 25? (yes or no) => no
Is 50 too high or too low (high or low) => low
Very good.  25 is too high.

Guess 3.  I know your number is between 25 and 50.
Is your number 31? (yes or no) => yes
I guessed 31 in 3 guesses.

Thank you for the fun game!
Your program should be fully interactive, and keep the user informed of what is happening at all times. While your interaction does not need to be exactly that of the above example, it should be contain all of the elements.

You should play as many games as the player wishes, switching rolls between games at the player's request.

Required Files

A single source code file and a design document.

Submission

Email your final source code file to danbennett360@gmail.com.