Package mastermind.core.solvers
Class HumanSolver
java.lang.Object
mastermind.core.solvers.MastermindSolver
mastermind.core.solvers.HumanSolver
A solver that allows a human player to guess the secret code.
It is the solver used for code maker mode.
It compares user input against generated secret code and provides hints.
-
Constructor Summary
ConstructorDescriptionHumanSolver
(Code secretCode) Constructs a HumanSolver instance with the given secret code. -
Method Summary
Methods inherited from class mastermind.core.solvers.MastermindSolver
getAttempts, hasExceededMaxGuesses, isInitialGuess
-
Constructor Details
-
HumanSolver
Constructs a HumanSolver instance with the given secret code.- Parameters:
secretCode
- the code to be guessed during the game
-
-
Method Details
-
guess
Evaluates a guess against the secret code and determines the game status.This method processes a given guess and generates a response indicating the correctness of the guess in terms of the secret code. Based on the number of correct matches and the player's remaining attempts, the method returns a tuple containing the game status and a response object.
The game status can be one of the following: -
Status.Win
: If the number of correct matches equals the code length. -Status.Lose
: If the maximum number of guesses is reached without success. -Status.Continue
: If the game is ongoing and further attempts are allowed.- Parameters:
guess
- the code guessed by the player- Returns:
- a tuple containing the game status and the response
-