mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-12 17:12:40 +01:00
DroidFish: Reinitialize tablebases when activity is started.
This commit is contained in:
@@ -208,6 +208,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
if (ctrl != null)
|
||||
ctrl.shutdownEngine();
|
||||
ctrl = new DroidChessController(this, gameTextListener, pgnOptions);
|
||||
egtbForceReload = true;
|
||||
readPrefs();
|
||||
ctrl.newGame(gameMode);
|
||||
{
|
||||
@@ -700,8 +701,12 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
ctrl.setBookOptions(options);
|
||||
}
|
||||
|
||||
private boolean egtbForceReload = false;
|
||||
|
||||
private final void setEgtbOptions() {
|
||||
ctrl.setEgtbOptions(new EGTBOptions(egtbOptions));
|
||||
Probe.getInstance().setPath(egtbOptions.gtbPath, egtbForceReload);
|
||||
egtbForceReload = false;
|
||||
}
|
||||
|
||||
private final void setEgtbHints(int sq) {
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.petero.droidfish.gamelogic.TextIO;
|
||||
import org.petero.droidfish.gamelogic.UndoInfo;
|
||||
import org.petero.droidfish.gamelogic.SearchListener.PvInfo;
|
||||
import org.petero.droidfish.gtb.Probe;
|
||||
import org.petero.droidfish.gtb.Probe.ProbeResult;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -49,7 +48,6 @@ public class DroidComputerPlayer {
|
||||
private final SearchListener listener;
|
||||
private final DroidBook book;
|
||||
private EGTBOptions egtbOptions;
|
||||
private final Probe gtbProbe;
|
||||
|
||||
/** Set when "ucinewgame" needs to be sent. */
|
||||
private boolean newGame = false;
|
||||
@@ -245,7 +243,6 @@ public class DroidComputerPlayer {
|
||||
this.listener = listener;
|
||||
book = DroidBook.getInstance();
|
||||
egtbOptions = new EGTBOptions();
|
||||
gtbProbe = Probe.getInstance();
|
||||
engineState = new EngineState();
|
||||
searchRequest = null;
|
||||
}
|
||||
@@ -275,7 +272,6 @@ public class DroidComputerPlayer {
|
||||
|
||||
public final void setEgtbOptions(EGTBOptions options) {
|
||||
egtbOptions = options;
|
||||
gtbProbe.setPath(options.gtbPath);
|
||||
}
|
||||
|
||||
/** Return all book moves, both as a formatted string and as a list of moves. */
|
||||
@@ -283,10 +279,6 @@ public class DroidComputerPlayer {
|
||||
return book.getAllBookMoves(pos);
|
||||
}
|
||||
|
||||
public final ProbeResult egtbProbe(Position pos) {
|
||||
return gtbProbe.probeHard(pos);
|
||||
}
|
||||
|
||||
/** Get engine reported name. */
|
||||
public final synchronized String getEngineName() {
|
||||
return engineName;
|
||||
@@ -339,9 +331,8 @@ public class DroidComputerPlayer {
|
||||
/** Decide what moves to search. Filters out non-optimal moves if tablebases are used. */
|
||||
private final ArrayList<Move> movesToSearch(SearchRequest sr) {
|
||||
ArrayList<Move> moves = null;
|
||||
if (egtbOptions.rootProbe) {
|
||||
moves = gtbProbe.findOptimal(sr.currPos);
|
||||
}
|
||||
if (egtbOptions.rootProbe)
|
||||
moves = Probe.getInstance().findOptimal(sr.currPos);
|
||||
if (moves != null) {
|
||||
sr.searchMoves = moves;
|
||||
} else {
|
||||
|
||||
@@ -29,8 +29,8 @@ class GtbProbe {
|
||||
GtbProbe() {
|
||||
}
|
||||
|
||||
final synchronized void setPath(String tbPath) {
|
||||
if (!currTbPath.equals(tbPath)) {
|
||||
final synchronized void setPath(String tbPath, boolean forceReload) {
|
||||
if (forceReload || !currTbPath.equals(tbPath)) {
|
||||
currTbPath = tbPath;
|
||||
init(tbPath);
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class Probe {
|
||||
blackPieces = new byte[65];
|
||||
}
|
||||
|
||||
public void setPath(String tbPath) {
|
||||
gtb.setPath(tbPath);
|
||||
public void setPath(String tbPath, boolean forceReload) {
|
||||
gtb.setPath(tbPath, forceReload);
|
||||
}
|
||||
|
||||
public static final class ProbeResult {
|
||||
|
||||
Reference in New Issue
Block a user