GeneralGuesser

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.255.140