The game contains 5 players. One Umpire, one Guesser and three Players.
The guesser guesses a number between 1 and 10 and tell it to the umpire secretly. The remaining 3 players try to predict the number guessed by the guesser.
The one who predicts the number accurately is the winner of the game.
If more than one Player predicts the right number, all of them are winners.
Class Diagram for the game:
The guessing game involves an ‘Umpire’ object , 'Guesser' object and three ‘player’ objects. All the objects are created by instantiating the above 3 classes.
Features Included in this game:
⇒ Restricted the all the players and guesser to guess a number between 1 and 10. Even if they predict/guess a number out of this range, then the program will prompt to re-enter the input until they're choosing a value with in allowed range.
⇒ added a counter to print player numbers in the console.
⇒ Print summary of the game after finding the winner. The summary includes Accuracy of prediction of players who lost the game.
Accuracy is displayed in terms of, how close number predicted by players towards the number guesser by guesser.
🖥The source code of the game is uploaded on GitHub:
https://bit.ly/3vGfAXo
🌎Connect with me on LinkedIn : https://www.linkedin.com/in/safvan-p/
Top comments (0)