DroidFish: Set the SearchListener in the DroidComputerPlayer constructor.

This commit is contained in:
Peter Osterlund 2011-12-28 14:35:47 +00:00
parent 519f104f0f
commit 99580477bd
2 changed files with 5 additions and 11 deletions

View File

@ -42,8 +42,8 @@ public class DroidComputerPlayer {
private String engineName = "";
private UCIEngine uciEngine = null;
private SearchListener listener;
private DroidBook book;
private final SearchListener listener;
private final DroidBook book;
/** Set when "ucinewgame" needs to be sent. */
private boolean newGame = false;
/** Engine identifier, "cuckoochess" or "stockfish". */
@ -56,10 +56,10 @@ public class DroidComputerPlayer {
private boolean havePonderHit = false;
/** Constructor. Starts engine process if not already started. */
public DroidComputerPlayer(String engine) {
public DroidComputerPlayer(String engine, SearchListener listener) {
this.engine = engine;
startEngine();
listener = null;
this.listener = listener;
book = DroidBook.getInstance();
}
@ -77,11 +77,6 @@ public class DroidComputerPlayer {
uciEngine.setStrength(strength);
}
/** Set search listener. */
public final void setListener(SearchListener listener) {
this.listener = listener;
}
/** Return maximum number of PVs supported by engine. */
public final synchronized int getMaxPV() {
return maxPV;

View File

@ -81,8 +81,7 @@ public class DroidChessController {
this.gameMode = gameMode;
ponderMove = null;
if (computerPlayer == null) {
computerPlayer = new DroidComputerPlayer(engine);
computerPlayer.setListener(listener);
computerPlayer = new DroidComputerPlayer(engine, listener);
computerPlayer.setBookOptions(bookOptions);
}
game = new Game(gameTextListener, timeControl, movesPerSession, timeIncrement);