DroidFish: Automatically restart engine when tablebase engine probing is changed.

This commit is contained in:
Peter Osterlund 2014-07-13 09:42:03 +00:00
parent 8becf3dc35
commit 696c6411ec
4 changed files with 33 additions and 23 deletions

View File

@ -400,7 +400,7 @@ you are not actively using the program.\
<string name="prefs_tbRootProbe_title">Probe at Root</string>
<string name="prefs_tbRootProbe_summary">Filter out non-optimal moves before starting search</string>
<string name="prefs_tbEngineProbe_title">Engine Probing</string>
<string name="prefs_tbEngineProbe_summary">Enable tablebase probing in engine, when supported. Takes effect next time engine is started</string>
<string name="prefs_tbEngineProbe_summary">Enable tablebase probing in engine, when supported</string>
<string name="prefs_gtbPath_title">GTB Directory</string>
<string name="prefs_gtbPath_summary">Directory where Gaviota tablebases are installed. Leave blank to use default directory</string>
<string name="prefs_gtbPathNet_title">GTB Network Directory</string>

View File

@ -25,10 +25,10 @@ public final class EngineOptions {
public boolean hintsEdit; // Hints in "edit board" mode
public boolean rootProbe; // Only search optimal moves at root
public boolean engineProbe; // Let engine use EGTB
public String gtbPath; // GTB directory path
public String gtbPathNet; // GTB directory path for network engines
public String rtbPath; // Syzygy directory path
public String rtbPathNet; // Syzygy directory path for network engines
String gtbPath; // GTB directory path
String gtbPathNet; // GTB directory path for network engines
String rtbPath; // Syzygy directory path
String rtbPathNet; // Syzygy directory path for network engines
public String networkID; // host+port network settings
public EngineOptions() {
@ -57,6 +57,20 @@ public final class EngineOptions {
networkID = other.networkID;
}
/** Get the GTB path for an engine. */
public String getEngineGtbPath(boolean networkEngine) {
if (!engineProbe)
return "";
return networkEngine ? gtbPathNet : gtbPath;
}
/** Get the RTB path for an engine. */
public String getEngineRtbPath(boolean networkEngine) {
if (!engineProbe)
return "";
return networkEngine ? rtbPathNet : rtbPath;
}
@Override
public boolean equals(Object o) {
if ((o == null) || (o.getClass() != this.getClass()))

View File

@ -174,13 +174,11 @@ public class ExternalEngine extends UCIEngineBase {
super.initOptions(engineOptions);
hashMB = getHashMB(engineOptions.hashMB);
setOption("Hash", hashMB);
if (engineOptions.engineProbe) {
gaviotaTbPath = engineOptions.gtbPath;
setOption("GaviotaTbPath", engineOptions.gtbPath);
setOption("GaviotaTbCache", 8);
syzygyPath = engineOptions.rtbPath;
setOption("SyzygyPath", engineOptions.rtbPath);
}
gaviotaTbPath = engineOptions.getEngineGtbPath(false);
setOption("GaviotaTbPath", gaviotaTbPath);
setOption("GaviotaTbCache", 8);
syzygyPath = engineOptions.getEngineRtbPath(false);
setOption("SyzygyPath", syzygyPath);
optionsInitialized = true;
}
@ -203,9 +201,9 @@ public class ExternalEngine extends UCIEngineBase {
return true;
if (hashMB != getHashMB(engineOptions.hashMB))
return false;
if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPath))
if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.getEngineGtbPath(false)))
return false;
if (hasOption("syzygypath") && !syzygyPath.equals(engineOptions.rtbPath))
if (hasOption("syzygypath") && !syzygyPath.equals(engineOptions.getEngineRtbPath(false)))
return false;
return true;
}

View File

@ -205,13 +205,11 @@ public class NetworkEngine extends UCIEngineBase {
super.initOptions(engineOptions);
hashMB = engineOptions.hashMB;
setOption("Hash", engineOptions.hashMB);
if (engineOptions.engineProbe) {
gaviotaTbPath = engineOptions.gtbPathNet;
setOption("GaviotaTbPath", engineOptions.gtbPathNet);
setOption("GaviotaTbCache", 8);
syzygyPath = engineOptions.rtbPathNet;
setOption("SyzygyPath", engineOptions.rtbPathNet);
}
gaviotaTbPath = engineOptions.getEngineGtbPath(true);
setOption("GaviotaTbPath", gaviotaTbPath);
setOption("GaviotaTbCache", 8);
syzygyPath = engineOptions.getEngineRtbPath(true);
setOption("SyzygyPath", syzygyPath);
optionsInitialized = true;
}
@ -226,9 +224,9 @@ public class NetworkEngine extends UCIEngineBase {
return false;
if (hashMB != engineOptions.hashMB)
return false;
if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPathNet))
if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.getEngineGtbPath(true)))
return false;
if (hasOption("syzygypath") && !syzygyPath.equals(engineOptions.rtbPathNet))
if (hasOption("syzygypath") && !syzygyPath.equals(engineOptions.getEngineRtbPath(true)))
return false;
return true;
}