Guesser

Guesser and the UniqueGuesser and GeneralGuesser subclasses are the most interesting classes of the program. They actually perform the task that is the core of the game. Given a Table with a hidden row, the guesser has to create newer and newer guesses.

To do this, a Guesser needs to get a Table when it is created. This is passed as a constructor argument. The only method it should implement is guess, which returns a new guess based on the table and on its actual state.

As we want to implement a guesser that assumes that all colors in the hidden row are different, and also one that does not make this assumption, we will implement three classes. Guesser is an abstract class that implements only the logic that is independent from the ...

Get Java 9 Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.