mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
CuckooChess: Changed node counters to long to avoid wraparound on long searches.
This commit is contained in:
parent
0dcdaeaa74
commit
c8b0b8a1d3
|
@ -95,7 +95,7 @@ public class EngineControl {
|
||||||
os.printf("info currmove %s currmovenumber %d%n", moveToString(m), moveNr);
|
os.printf("info currmove %s currmovenumber %d%n", moveToString(m), moveNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyPV(int depth, int score, int time, int nodes, int nps, boolean isMate,
|
public void notifyPV(int depth, int score, int time, long nodes, int nps, boolean isMate,
|
||||||
boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
|
boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
|
||||||
StringBuilder pvBuf = new StringBuilder();
|
StringBuilder pvBuf = new StringBuilder();
|
||||||
for (Move m : pv) {
|
for (Move m : pv) {
|
||||||
|
@ -112,7 +112,7 @@ public class EngineControl {
|
||||||
depth, isMate ? "mate" : "cp", score, bound, time, nodes, nps, pvBuf.toString());
|
depth, isMate ? "mate" : "cp", score, bound, time, nodes, nps, pvBuf.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyStats(int nodes, int nps, int time) {
|
public void notifyStats(long nodes, int nps, int time) {
|
||||||
os.printf("info nodes %d nps %d time %d%n", nodes, nps, time);
|
os.printf("info nodes %d nps %d time %d%n", nodes, nps, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class ComputerPlayer implements Player {
|
||||||
public static final String engineName;
|
public static final String engineName;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String name = "CuckooChess 1.13a3";
|
String name = "CuckooChess 1.13a4";
|
||||||
String m = System.getProperty("sun.arch.data.model");
|
String m = System.getProperty("sun.arch.data.model");
|
||||||
if ("32".equals(m))
|
if ("32".equals(m))
|
||||||
name += " 32-bit";
|
name += " 32-bit";
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class Search {
|
||||||
long minTimeMillis; // Minimum recommended thinking time
|
long minTimeMillis; // Minimum recommended thinking time
|
||||||
long maxTimeMillis; // Maximum allowed thinking time
|
long maxTimeMillis; // Maximum allowed thinking time
|
||||||
boolean searchNeedMoreTime; // True if negaScout should use up to maxTimeMillis time.
|
boolean searchNeedMoreTime; // True if negaScout should use up to maxTimeMillis time.
|
||||||
private int maxNodes; // Maximum number of nodes to search (approximately)
|
private long maxNodes; // Maximum number of nodes to search (approximately)
|
||||||
int nodesToGo; // Number of nodes until next time check
|
int nodesToGo; // Number of nodes until next time check
|
||||||
public int nodesBetweenTimeCheck = 5000; // How often to check remaining time
|
public int nodesBetweenTimeCheck = 5000; // How often to check remaining time
|
||||||
|
|
||||||
|
@ -74,11 +74,11 @@ public class Search {
|
||||||
long randomSeed = 0;
|
long randomSeed = 0;
|
||||||
|
|
||||||
// Search statistics stuff
|
// Search statistics stuff
|
||||||
int nodes;
|
long nodes;
|
||||||
int qNodes;
|
long qNodes;
|
||||||
int[] nodesPlyVec;
|
int[] nodesPlyVec;
|
||||||
int[] nodesDepthVec;
|
int[] nodesDepthVec;
|
||||||
int totalNodes;
|
long totalNodes;
|
||||||
long tLastStats; // Time when notifyStats was last called
|
long tLastStats; // Time when notifyStats was last called
|
||||||
boolean verbose;
|
boolean verbose;
|
||||||
|
|
||||||
|
@ -124,9 +124,9 @@ public class Search {
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
public void notifyDepth(int depth);
|
public void notifyDepth(int depth);
|
||||||
public void notifyCurrMove(Move m, int moveNr);
|
public void notifyCurrMove(Move m, int moveNr);
|
||||||
public void notifyPV(int depth, int score, int time, int nodes, int nps,
|
public void notifyPV(int depth, int score, int time, long nodes, int nps,
|
||||||
boolean isMate, boolean upperBound, boolean lowerBound, ArrayList<Move> pv);
|
boolean isMate, boolean upperBound, boolean lowerBound, ArrayList<Move> pv);
|
||||||
public void notifyStats(int nodes, int nps, int time);
|
public void notifyStats(long nodes, int nps, int time);
|
||||||
}
|
}
|
||||||
|
|
||||||
Listener listener;
|
Listener listener;
|
||||||
|
@ -136,7 +136,7 @@ public class Search {
|
||||||
|
|
||||||
private final static class MoveInfo {
|
private final static class MoveInfo {
|
||||||
Move move;
|
Move move;
|
||||||
int nodes;
|
long nodes;
|
||||||
MoveInfo(Move m, int n) { move = m; nodes = n; }
|
MoveInfo(Move m, int n) { move = m; nodes = n; }
|
||||||
public static final class SortByScore implements Comparator<MoveInfo> {
|
public static final class SortByScore implements Comparator<MoveInfo> {
|
||||||
public int compare(MoveInfo mi1, MoveInfo mi2) {
|
public int compare(MoveInfo mi1, MoveInfo mi2) {
|
||||||
|
@ -157,7 +157,13 @@ public class Search {
|
||||||
return 1;
|
return 1;
|
||||||
if (mi2 == null)
|
if (mi2 == null)
|
||||||
return -1;
|
return -1;
|
||||||
return mi2.nodes - mi1.nodes;
|
long d = mi2.nodes - mi1.nodes;
|
||||||
|
if (d < 0)
|
||||||
|
return -1;
|
||||||
|
else if (d > 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +182,7 @@ public class Search {
|
||||||
}
|
}
|
||||||
|
|
||||||
final public Move iterativeDeepening(MoveGen.MoveList scMovesIn,
|
final public Move iterativeDeepening(MoveGen.MoveList scMovesIn,
|
||||||
int maxDepth, int initialMaxNodes, boolean verbose) {
|
int maxDepth, long initialMaxNodes, boolean verbose) {
|
||||||
tStart = System.currentTimeMillis();
|
tStart = System.currentTimeMillis();
|
||||||
// log = TreeLogger.getWriter("/home/petero/treelog.dmp", pos);
|
// log = TreeLogger.getWriter("/home/petero/treelog.dmp", pos);
|
||||||
totalNodes = 0;
|
totalNodes = 0;
|
||||||
|
@ -234,8 +240,8 @@ public class Search {
|
||||||
lmrS = plyScale;
|
lmrS = plyScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* int nodes0 = nodes;
|
/* long nodes0 = nodes;
|
||||||
int qNodes0 = qNodes;
|
long qNodes0 = qNodes;
|
||||||
System.out.printf("%2d %5s %5d %5d %6s %6s ",
|
System.out.printf("%2d %5s %5d %5d %6s %6s ",
|
||||||
mi, "-", alpha, beta, "-", "-");
|
mi, "-", alpha, beta, "-", "-");
|
||||||
System.out.printf("%-6s...\n", TextIO.moveToUCIString(m)); */
|
System.out.printf("%-6s...\n", TextIO.moveToUCIString(m)); */
|
||||||
|
@ -249,7 +255,7 @@ public class Search {
|
||||||
sti.lmr = 0;
|
sti.lmr = 0;
|
||||||
score = -negaScout(-beta, -alpha, 1, depthS - plyScale, -1, givesCheck);
|
score = -negaScout(-beta, -alpha, 1, depthS - plyScale, -1, givesCheck);
|
||||||
}
|
}
|
||||||
int nodesThisMove = nodes + qNodes;
|
long nodesThisMove = nodes + qNodes;
|
||||||
posHashListSize--;
|
posHashListSize--;
|
||||||
pos.unMakeMove(m, ui);
|
pos.unMakeMove(m, ui);
|
||||||
{
|
{
|
||||||
|
@ -749,8 +755,8 @@ public class Search {
|
||||||
nodes++;
|
nodes++;
|
||||||
totalNodes++;
|
totalNodes++;
|
||||||
sti.currentMove = m;
|
sti.currentMove = m;
|
||||||
/* int nodes0 = nodes;
|
/* long nodes0 = nodes;
|
||||||
int qNodes0 = qNodes;
|
long qNodes0 = qNodes;
|
||||||
if ((ply < 3) && (newDepth > plyScale)) {
|
if ((ply < 3) && (newDepth > plyScale)) {
|
||||||
System.out.printf("%2d %5s %5d %5d %6s %6s ",
|
System.out.printf("%2d %5s %5d %5d %6s %6s ",
|
||||||
mi, "-", alpha, beta, "-", "-");
|
mi, "-", alpha, beta, "-", "-");
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class ChessController {
|
||||||
int currDepth = 0;
|
int currDepth = 0;
|
||||||
int currMoveNr = 0;
|
int currMoveNr = 0;
|
||||||
String currMove = "";
|
String currMove = "";
|
||||||
int currNodes = 0;
|
long currNodes = 0;
|
||||||
int currNps = 0;
|
int currNps = 0;
|
||||||
int currTime = 0;
|
int currTime = 0;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class ChessController {
|
||||||
setSearchInfo();
|
setSearchInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyPV(int depth, int score, int time, int nodes, int nps, boolean isMate,
|
public void notifyPV(int depth, int score, int time, long nodes, int nps, boolean isMate,
|
||||||
boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
|
boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
|
||||||
pvDepth = depth;
|
pvDepth = depth;
|
||||||
pvScore = score;
|
pvScore = score;
|
||||||
|
@ -128,7 +128,7 @@ public class ChessController {
|
||||||
setSearchInfo();
|
setSearchInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyStats(int nodes, int nps, int time) {
|
public void notifyStats(long nodes, int nps, int time) {
|
||||||
currNodes = nodes;
|
currNodes = nodes;
|
||||||
currNps = nps;
|
currNps = nps;
|
||||||
currTime = time;
|
currTime = time;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class DroidEngineControl {
|
||||||
os.printf("info currmove %s currmovenumber %d%n", moveToString(m), moveNr);
|
os.printf("info currmove %s currmovenumber %d%n", moveToString(m), moveNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyPV(int depth, int score, int time, int nodes, int nps, boolean isMate,
|
public void notifyPV(int depth, int score, int time, long nodes, int nps, boolean isMate,
|
||||||
boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
|
boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
|
||||||
StringBuilder pvBuf = new StringBuilder();
|
StringBuilder pvBuf = new StringBuilder();
|
||||||
for (Move m : pv) {
|
for (Move m : pv) {
|
||||||
|
@ -107,7 +107,7 @@ public class DroidEngineControl {
|
||||||
depth, isMate ? "mate" : "cp", score, bound, time, nodes, nps, pvBuf.toString());
|
depth, isMate ? "mate" : "cp", score, bound, time, nodes, nps, pvBuf.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyStats(int nodes, int nps, int time) {
|
public void notifyStats(long nodes, int nps, int time) {
|
||||||
os.printf("info nodes %d nps %d time %d%n", nodes, nps, time);
|
os.printf("info nodes %d nps %d time %d%n", nodes, nps, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user