April 2017
Beginner
504 pages
14h 11m
English
Class GeneralGuesser also has to implement the constructor and setFirstGuess, but generally, that is it.
package packt.java9.by.example.mastermind; public class GeneralGuesser extends Guesser { public GeneralGuesser(Table table) { super(table); } @Override protected void setFirstGuess() { int i = 0; for (Color color = table.manager.firstColor(); i < lastGuess.length; ) { lastGuess[i++] = color; } } }
Setting the lastGuess it just puts the first color on all columns. Guess could not be simpler. Everything else is inherited from the abstract class Guesser.
Read now
Unlock full access