Package mastermind.core.solvers
Class MastermindAlgorithm
java.lang.Object
mastermind.core.solvers.MastermindSolver
mastermind.core.solvers.MastermindAlgorithm
- Direct Known Subclasses:
DonaldKnuthAlgorithm
,EasyAlgorithm
,MediumAlgorithm
The standard interface for all algorithmic solvers.
It extends the MastermindSolver
class and exposes 2
methods, guess()
and guess(Response)
,
representing first and subsequent guesses, respectively.
The GUI depends on above interface to communicate with the solver.
-
Constructor Summary
-
Method Summary
Methods inherited from class mastermind.core.solvers.MastermindSolver
getAttempts, hasExceededMaxGuesses, isInitialGuess
-
Constructor Details
-
MastermindAlgorithm
public MastermindAlgorithm()Default constructor.
-
-
Method Details
-
guess
This is the first guess an algorithm will make.- Returns:
- The first guess as an instance of
Code
.
-
guess
Produces a new guess based on the provided response from the previous guess.- Parameters:
response
- The feedback from the last guess.- Returns:
- A
Tuple2
containing theStatus
and the generatedCode
.
-