mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-03-11 15:58:08 +01:00
DroidFish: Set the SearchListener in the DroidComputerPlayer constructor.
This commit is contained in:
parent
519f104f0f
commit
99580477bd
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user