add hashfull information

This commit is contained in:
Aprijal Pasaribu 2016-10-17 22:36:14 +07:00
parent c144bb9800
commit cf56850d7e
3 changed files with 18 additions and 6 deletions

View File

@ -888,6 +888,7 @@ public class DroidComputerPlayer {
private int statTime = 0;
private long statNodes = 0;
private long statTBHits = 0;
private int statHash = 0;
private int statNps = 0;
private ArrayList<String> statPV = new ArrayList<String>();
private String statCurrMove = "";
@ -905,6 +906,7 @@ public class DroidComputerPlayer {
statIsMate = statUpperBound = statLowerBound = false;
statTime = 0;
statNodes = statTBHits = 0;
statHash = 0;
statNps = 0;
depthModified = true;
currMoveModified = true;
@ -952,6 +954,9 @@ public class DroidComputerPlayer {
} else if (is.equals("tbhits")) {
statTBHits = Long.parseLong(tokens[i++]);
statsModified = true;
}else if (is.equals("hashfull")) {
statHash = Integer.parseInt(tokens[i++]);
statsModified = true;
} else if (is.equals("nps")) {
statNps = Integer.parseInt(tokens[i++]);
statsModified = true;
@ -984,14 +989,14 @@ public class DroidComputerPlayer {
}
if (havePvData) {
while (statPvInfo.size() < pvNum)
statPvInfo.add(new PvInfo(0, 0, 0, 0, 0, 0, false, false, false, new ArrayList<Move>()));
statPvInfo.add(new PvInfo(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>();
int nMoves = statPV.size();
for (i = 0; i < nMoves; i++)
moves.add(TextIO.UCIstringToMove(statPV.get(i)));
statPvInfo.set(pvNum, new PvInfo(statPVDepth, statScore, statTime, statNodes, statNps, statTBHits,
statPvInfo.set(pvNum, new PvInfo(statPVDepth, statScore, statTime, statNodes, statNps, statTBHits, statHash,
statIsMate, statUpperBound, statLowerBound, moves));
}
} catch (NumberFormatException nfe) {
@ -1036,7 +1041,7 @@ public class DroidComputerPlayer {
pvModified = false;
}
if (statsModified) {
listener.notifyStats(id, statNodes, statNps, statTBHits, statTime);
listener.notifyStats(id, statNodes, statNps, statTBHits, statHash, statTime);
statsModified = false;
}
}

View File

@ -676,6 +676,7 @@ public class DroidChessController {
private long currNodes = 0;
private int currNps = 0;
private long currTBHits = 0;
private int currHash = 0;
private int currTime = 0;
private boolean whiteMove = true;
@ -760,6 +761,9 @@ public class DroidChessController {
}
statStrTmp.append(String.format(Locale.US, " tb:%d%s", tbHits, tbHitsPrefix));
}
if(currHash > 0){
statStrTmp.append(String.format(Locale.US, " h:%d", currHash / 10));
}
}
final String statStr = statStrTmp.toString();
final String newPV = buf.toString();
@ -842,10 +846,11 @@ public class DroidChessController {
}
@Override
public void notifyStats(int id, long nodes, int nps, long tbHits, int time) {
public void notifyStats(int id, long nodes, int nps, long tbHits, int hash, int time) {
currNodes = nodes;
currNps = nps;
currTBHits = tbHits;
currHash = hash;
currTime = time;
setSearchInfo(id);
}

View File

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