DroidFish: Add seldepth info.

Show selective search depth in the status area when the engine is
thinking.

From Christoph Heilmann.
This commit is contained in:
Peter Osterlund 2017-11-23 19:40:54 +01:00
parent 32048fc152
commit 6277419793
3 changed files with 17 additions and 6 deletions

View File

@ -895,6 +895,7 @@ public class DroidComputerPlayer {
private long statNodes = 0;
private long statTBHits = 0;
private int statHash = 0;
private int statSelDepth = 0;
private int statNps = 0;
private ArrayList<String> statPV = new ArrayList<String>();
private String statCurrMove = "";
@ -913,6 +914,7 @@ public class DroidComputerPlayer {
statTime = 0;
statNodes = statTBHits = 0;
statHash = 0;
statSelDepth = 0;
statNps = 0;
depthModified = true;
currMoveModified = true;
@ -945,6 +947,9 @@ public class DroidComputerPlayer {
if (is.equals("depth")) {
statCurrDepth = Integer.parseInt(tokens[i++]);
depthModified = true;
} else if (is.equals("seldepth")) {
statSelDepth = Integer.parseInt(tokens[i++]);
statsModified = true;
} else if (is.equals("currmove")) {
statCurrMove = tokens[i++];
currMoveModified = true;
@ -995,7 +1000,7 @@ public class DroidComputerPlayer {
}
if (havePvData) {
while (statPvInfo.size() < pvNum)
statPvInfo.add(new PvInfo(0, 0, 0, 0, 0, 0, 0, false, false, false, new ArrayList<Move>()));
statPvInfo.add(new PvInfo(0, 0, 0, 0, 0, 0, 0, 0, false, false, false, new ArrayList<Move>()));
while (statPvInfo.size() <= pvNum)
statPvInfo.add(null);
ArrayList<Move> moves = new ArrayList<Move>();
@ -1003,7 +1008,7 @@ public class DroidComputerPlayer {
for (i = 0; i < nMoves; i++)
moves.add(TextIO.UCIstringToMove(statPV.get(i)));
statPvInfo.set(pvNum, new PvInfo(statPVDepth, statScore, statTime, statNodes, statNps,
statTBHits, statHash,
statTBHits, statHash, statSelDepth,
statIsMate, statUpperBound, statLowerBound, moves));
}
} catch (NumberFormatException nfe) {
@ -1047,7 +1052,7 @@ public class DroidComputerPlayer {
pvModified = false;
}
if (statsModified) {
listener.notifyStats(id, statNodes, statNps, statTBHits, statHash, statTime);
listener.notifyStats(id, statNodes, statNps, statTBHits, statHash, statTime, statSelDepth);
statsModified = false;
}
lastGUIUpdate = System.currentTimeMillis();

View File

@ -696,6 +696,7 @@ public class DroidChessController {
private long currTBHits = 0;
private int currHash = 0;
private int currTime = 0;
private int currSelDepth = 0;
private boolean whiteMove = true;
private String bookInfo = "";
@ -745,6 +746,8 @@ public class DroidChessController {
StringBuilder statStrTmp = new StringBuilder();
if (currDepth > 0) {
statStrTmp.append(String.format(Locale.US, "d:%d", currDepth));
if (currSelDepth > 0)
statStrTmp.append(String.format(Locale.US, "/%d", currSelDepth));
if (currMoveNr > 0)
statStrTmp.append(String.format(Locale.US, " %d:%s", currMoveNr, currMoveStr));
if (currTime < 99995) {
@ -866,12 +869,13 @@ public class DroidChessController {
}
@Override
public void notifyStats(int id, long nodes, int nps, long tbHits, int hash, int time) {
public void notifyStats(int id, long nodes, int nps, long tbHits, int hash, int time, int seldepth) {
currNodes = nodes;
currNps = nps;
currTBHits = tbHits;
currHash = hash;
currTime = time;
currSelDepth = seldepth;
setSearchInfo(id);
}

View File

@ -33,13 +33,14 @@ public interface SearchListener {
int nps;
long tbHits;
int hash;
int seldepth;
boolean isMate;
boolean upperBound;
boolean lowerBound;
ArrayList<Move> pv;
String pvStr = "";
public PvInfo(int depth, int score, int time, long nodes, int nps, long tbHits, int hash,
public PvInfo(int depth, int score, int time, long nodes, int nps, long tbHits, int hash, int seldepth,
boolean isMate, boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
this.depth = depth;
this.score = score;
@ -48,6 +49,7 @@ public interface SearchListener {
this.nps = nps;
this.tbHits = tbHits;
this.hash = hash;
this.seldepth = seldepth;
this.isMate = isMate;
this.upperBound = upperBound;
this.lowerBound = lowerBound;
@ -68,7 +70,7 @@ public interface SearchListener {
void notifyPV(int id, Position pos, ArrayList<PvInfo> pvInfo, Move ponderMove);
/** Report search statistics. */
void notifyStats(int id, long nodes, int nps, long tbHits, int hash, int time);
void notifyStats(int id, long nodes, int nps, long tbHits, int hash, int time, int seldepth);
/** Report opening book information. */
void notifyBookInfo(int id, String bookInfo, ArrayList<Move> moveList,