April 2017
Beginner
504 pages
14h 11m
English
Class UniqueGuesser has to implement setFirstGuess (all concrete classes extending an abstract class should implement the abstract method of the parent) and it can and will override the protected nextGuess method:
package packt.java9.by.example.mastermind; import java.util.HashSet; import java.util.Set; public class UniqueGuesser extends Guesser { public UniqueGuesser(Table table) { super(table); } @Override protected void setFirstGuess() { int i = lastGuess.length-1; for (Color color = table.manager.firstColor(); i >= 0; color = table.manager.nextColor(color)) { lastGuess[i--] = color; } }
The setFirstGuess method selects the first guess in such a way that any possible color variations that come after the ...
Read now
Unlock full access