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

View File

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

View File

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