mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
Reduce maxNPS when UCI_LimitStrength is enabled
This commit is contained in:
parent
ed47fc0888
commit
7610745dc5
|
@ -229,7 +229,7 @@ public class EngineControl {
|
||||||
sc = new Search(pos, posHashList, posHashListSize, tt, ht);
|
sc = new Search(pos, posHashList, posHashListSize, tt, ht);
|
||||||
sc.timeLimit(minTimeLimit, maxTimeLimit);
|
sc.timeLimit(minTimeLimit, maxTimeLimit);
|
||||||
sc.setListener(new SearchListener(os));
|
sc.setListener(new SearchListener(os));
|
||||||
sc.setStrength(getStrength(), randomSeed, maxNPS);
|
sc.setStrength(getStrength(), randomSeed, getMaxNPS());
|
||||||
MoveGen.MoveList moves = moveGen.pseudoLegalMoves(pos);
|
MoveGen.MoveList moves = moveGen.pseudoLegalMoves(pos);
|
||||||
MoveGen.removeIllegal(pos, moves);
|
MoveGen.removeIllegal(pos, moves);
|
||||||
if ((searchMoves != null) && (searchMoves.size() > 0))
|
if ((searchMoves != null) && (searchMoves.size() > 0))
|
||||||
|
@ -483,4 +483,19 @@ public class EngineControl {
|
||||||
}
|
}
|
||||||
return eloToStrength[n-1][1];
|
return eloToStrength[n-1][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return adjusted maxNPS value if UCI_LimitStrength is enabled. */
|
||||||
|
private int getMaxNPS() {
|
||||||
|
int intMax = Integer.MAX_VALUE;
|
||||||
|
int nps1 = maxNPS == 0 ? intMax : maxNPS;
|
||||||
|
int nps2 = nps1;
|
||||||
|
if (limitStrength) {
|
||||||
|
if (elo < 1350)
|
||||||
|
nps2 = Math.min(10000, nps2);
|
||||||
|
else
|
||||||
|
nps2 = Math.min(100000, nps2);
|
||||||
|
}
|
||||||
|
int nps = Math.min(nps1, nps2);
|
||||||
|
return nps == intMax ? 0 : nps;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class DroidEngineControl {
|
||||||
sc = new Search(pos, posHashList, posHashListSize, tt, ht);
|
sc = new Search(pos, posHashList, posHashListSize, tt, ht);
|
||||||
sc.timeLimit(minTimeLimit, maxTimeLimit);
|
sc.timeLimit(minTimeLimit, maxTimeLimit);
|
||||||
sc.setListener(new SearchListener(os));
|
sc.setListener(new SearchListener(os));
|
||||||
sc.setStrength(getStrength(), randomSeed, maxNPS);
|
sc.setStrength(getStrength(), randomSeed, getMaxNPS());
|
||||||
sc.nodesBetweenTimeCheck = Math.min(500, sc.nodesBetweenTimeCheck);
|
sc.nodesBetweenTimeCheck = Math.min(500, sc.nodesBetweenTimeCheck);
|
||||||
MoveGen.MoveList moves = moveGen.pseudoLegalMoves(pos);
|
MoveGen.MoveList moves = moveGen.pseudoLegalMoves(pos);
|
||||||
MoveGen.removeIllegal(pos, moves);
|
MoveGen.removeIllegal(pos, moves);
|
||||||
|
@ -442,4 +442,19 @@ public class DroidEngineControl {
|
||||||
}
|
}
|
||||||
return eloToStrength[n-1][1];
|
return eloToStrength[n-1][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return adjusted maxNPS value if UCI_LimitStrength is enabled. */
|
||||||
|
private int getMaxNPS() {
|
||||||
|
int intMax = Integer.MAX_VALUE;
|
||||||
|
int nps1 = maxNPS == 0 ? intMax : maxNPS;
|
||||||
|
int nps2 = nps1;
|
||||||
|
if (limitStrength) {
|
||||||
|
if (elo < 1350)
|
||||||
|
nps2 = Math.min(10000, nps2);
|
||||||
|
else
|
||||||
|
nps2 = Math.min(100000, nps2);
|
||||||
|
}
|
||||||
|
int nps = Math.min(nps1, nps2);
|
||||||
|
return nps == intMax ? 0 : nps;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user