Mastermind is a puzzle game in which a player must guess a secret color combination in a limited number of attempts. In this virtual version, the computer generates the secret combination and evaluates the player's suggestions.
The player can start a new game from the main menu. The game ends when the player correctly guesses the combination (win) or exhausts all attempts (lose). A message displays the result (win or lose).
- Secret combination generation: The computer randomly generates a combination.
- Proposal evaluation: For each player's proposal, the number of red and white pawns is calculated.
- Victory condition: The player wins if he discovers the combination before exhausting his attempts.
- Defeat condition: The player loses if he hasn't discovered the combination after using up all his attempts.
For each suggestion, the game displays :
- The number of attempts.
- The proposed combination.
- The number of red pawns (right colors in the right place).
- The number of white pawns (right colors in the wrong place).
- A history of previous attempts is displayed to help players refine their proposals.
The player can save the current game at any time via the play menu. A saved game can be resumed later from the main menu.