Game description: the user needs to guess the positive integer selected by the computer with the minimum number of attempts.
|
There will be meaningless point system for illustrative purposes; there also will be hints depending on the number of attempts used to guess the integer. Finally, we'll provide an opportunity to set the range of selected numbers ("from" ... "to" ...).
The example of the program work:
------------------------------
The computer has selected the number, try to guess it!
------------------------------
Earned points: 100
High score: 0
Enter the number from 10 to 99: 75
Icy
...
------------------------------
Earned points: 9
High score: 0
Enter the number from 10 to 99: 47
****************************************
You won! Congratulations!
Enter - play again, 0 - exit
Point are deducted each time the user enters something. The game is over when the user either guess the computer's number or runs out of points. That is, the less points the user has, the more attempts were used, the more points - the more attempts are left.
The program will give the hints: whether the guessed number is greater or less than computer's one, is it a multiple of 4, 3, 2. All hints may be calibrated by choice. You can even completely reconfigure them.
Purpose of the game: to demonstrate basic architecture of game (and educational) algorithms.
Well, it's time to start!
© 2019-2024 Viktor Trofimov |