mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-01-30 17:13:50 +01:00
DroidFish: Added "secret" way to allocate an unsafely large hash table.
This commit is contained in:
parent
23511ee76d
commit
929f77ced2
|
@ -1048,27 +1048,24 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
bookOptions.random = (settings.getInt("bookRandom", 500) - 500) * (3.0 / 500);
|
||||
setBookOptions();
|
||||
|
||||
File extDir = Environment.getExternalStorageDirectory();
|
||||
String sep = File.separator;
|
||||
engineOptions.hashMB = getIntSetting("hashMB", 16);
|
||||
engineOptions.unSafeHash = new File(extDir + sep + engineDir + sep + ".unsafehash").exists();
|
||||
engineOptions.hints = settings.getBoolean("tbHints", false);
|
||||
engineOptions.hintsEdit = settings.getBoolean("tbHintsEdit", false);
|
||||
engineOptions.rootProbe = settings.getBoolean("tbRootProbe", true);
|
||||
engineOptions.engineProbe = settings.getBoolean("tbEngineProbe", true);
|
||||
|
||||
String gtbPath = settings.getString("gtbPath", "").trim();
|
||||
if (gtbPath.length() == 0) {
|
||||
File extDir = Environment.getExternalStorageDirectory();
|
||||
String sep = File.separator;
|
||||
if (gtbPath.length() == 0)
|
||||
gtbPath = extDir.getAbsolutePath() + sep + gtbDefaultDir;
|
||||
}
|
||||
engineOptions.gtbPath = gtbPath;
|
||||
String gtbPathNet = settings.getString("gtbPathNet", "").trim();
|
||||
engineOptions.gtbPathNet = gtbPathNet;
|
||||
String rtbPath = settings.getString("rtbPath", "").trim();
|
||||
if (rtbPath.length() == 0) {
|
||||
File extDir = Environment.getExternalStorageDirectory();
|
||||
String sep = File.separator;
|
||||
if (rtbPath.length() == 0)
|
||||
rtbPath = extDir.getAbsolutePath() + sep + rtbDefaultDir;
|
||||
}
|
||||
engineOptions.rtbPath = rtbPath;
|
||||
String rtbPathNet = settings.getString("rtbPathNet", "").trim();
|
||||
engineOptions.rtbPathNet = rtbPathNet;
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.petero.droidfish;
|
|||
/** Engine options, including endgame tablebase probing options. */
|
||||
public final class EngineOptions {
|
||||
public int hashMB; // Engine hash table size in MB
|
||||
public boolean unSafeHash; // True if allocating very large hash is allowed
|
||||
public boolean hints; // Hints when playing/analyzing
|
||||
public boolean hintsEdit; // Hints in "edit board" mode
|
||||
public boolean rootProbe; // Only search optimal moves at root
|
||||
|
@ -33,6 +34,7 @@ public final class EngineOptions {
|
|||
|
||||
public EngineOptions() {
|
||||
hashMB = 16;
|
||||
unSafeHash = false;
|
||||
hints = false;
|
||||
hintsEdit = false;
|
||||
rootProbe = false;
|
||||
|
@ -46,6 +48,7 @@ public final class EngineOptions {
|
|||
|
||||
public EngineOptions(EngineOptions other) {
|
||||
hashMB = other.hashMB;
|
||||
unSafeHash = other.unSafeHash;
|
||||
hints = other.hints;
|
||||
hintsEdit = other.hintsEdit;
|
||||
rootProbe = other.rootProbe;
|
||||
|
@ -78,6 +81,7 @@ public final class EngineOptions {
|
|||
EngineOptions other = (EngineOptions)o;
|
||||
|
||||
return ((hashMB == other.hashMB) &&
|
||||
(unSafeHash == other.unSafeHash) &&
|
||||
(hints == other.hints) &&
|
||||
(hintsEdit == other.hintsEdit) &&
|
||||
(rootProbe == other.rootProbe) &&
|
||||
|
|
|
@ -205,7 +205,7 @@ public class ExternalEngine extends UCIEngineBase {
|
|||
@Override
|
||||
public void initOptions(EngineOptions engineOptions) {
|
||||
super.initOptions(engineOptions);
|
||||
hashMB = getHashMB(engineOptions.hashMB);
|
||||
hashMB = getHashMB(engineOptions);
|
||||
setOption("Hash", hashMB);
|
||||
syzygyPath = engineOptions.getEngineRtbPath(false);
|
||||
setOption("SyzygyPath", syzygyPath);
|
||||
|
@ -220,8 +220,9 @@ public class ExternalEngine extends UCIEngineBase {
|
|||
}
|
||||
|
||||
/** Reduce too large hash sizes. */
|
||||
private final int getHashMB(int hashMB) {
|
||||
if (hashMB > 16) {
|
||||
private final static int getHashMB(EngineOptions engineOptions) {
|
||||
int hashMB = engineOptions.hashMB;
|
||||
if (hashMB > 16 && !engineOptions.unSafeHash) {
|
||||
int maxMem = (int)(Runtime.getRuntime().maxMemory() / (1024*1024));
|
||||
if (maxMem < 16)
|
||||
maxMem = 16;
|
||||
|
@ -236,7 +237,7 @@ public class ExternalEngine extends UCIEngineBase {
|
|||
public boolean optionsOk(EngineOptions engineOptions) {
|
||||
if (!optionsInitialized)
|
||||
return true;
|
||||
if (hashMB != getHashMB(engineOptions.hashMB))
|
||||
if (hashMB != getHashMB(engineOptions))
|
||||
return false;
|
||||
if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.getEngineGtbPath(false)))
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user