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_title">Probe at Root</string>
<string name="prefs_tbRootProbe_summary">Filter out non-optimal moves before starting search</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_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_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_gtbPath_summary">Directory where Gaviota tablebases are installed. Leave blank to use default directory</string>
<string name="prefs_gtbPathNet_title">GTB Network 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 hintsEdit; // Hints in "edit board" mode
public boolean rootProbe; // Only search optimal moves at root public boolean rootProbe; // Only search optimal moves at root
public boolean engineProbe; // Let engine use EGTB public boolean engineProbe; // Let engine use EGTB
public String gtbPath; // GTB directory path String gtbPath; // GTB directory path
public String gtbPathNet; // GTB directory path for network engines String gtbPathNet; // GTB directory path for network engines
public String rtbPath; // Syzygy directory path String rtbPath; // Syzygy directory path
public String rtbPathNet; // Syzygy directory path for network engines String rtbPathNet; // Syzygy directory path for network engines
public String networkID; // host+port network settings public String networkID; // host+port network settings
public EngineOptions() { public EngineOptions() {
@@ -57,6 +57,20 @@ public final class EngineOptions {
networkID = other.networkID; 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 @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if ((o == null) || (o.getClass() != this.getClass())) if ((o == null) || (o.getClass() != this.getClass()))

View File

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

View File

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