The Guesser abstract class 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 new 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 in its actual state.

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 to do this. Guesser is an abstract class that implements only the logic that is independent ...

Get Java Projects - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.