Class MastermindAlgorithm

java.lang.Object
mastermind.core.solvers.MastermindSolver
mastermind.core.solvers.MastermindAlgorithm
Direct Known Subclasses:
DonaldKnuthAlgorithm, EasyAlgorithm, MediumAlgorithm

public abstract class MastermindAlgorithm extends MastermindSolver
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 Details

    • MastermindAlgorithm

      public MastermindAlgorithm()
      Default constructor.
  • Method Details

    • guess

      public abstract Code guess()
      This is the first guess an algorithm will make.
      Returns:
      The first guess as an instance of Code.
    • guess

      public abstract Tuple2<Status,Code> guess(Response response)
      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 the Status and the generated Code.