DroidFish: Use k and M prefixes for nodes and nodes/second in the engine status information.

This commit is contained in:
Peter Osterlund 2012-09-01 18:59:43 +00:00
parent 2798f59554
commit 7967615386
3 changed files with 28 additions and 11 deletions

View File

@ -844,7 +844,7 @@ public class DroidComputerPlayer {
private boolean statUpperBound = false;
private boolean statLowerBound = false;
private int statTime = 0;
private int statNodes = 0;
private long statNodes = 0;
private int statNps = 0;
private int pvNum = 0;
private ArrayList<String> statPV = new ArrayList<String>();
@ -897,7 +897,7 @@ public class DroidComputerPlayer {
statTime = Integer.parseInt(tokens[i++]);
statsModified = true;
} else if (is.equals("nodes")) {
statNodes = Integer.parseInt(tokens[i++]);
statNodes = Long.parseLong(tokens[i++]);
statsModified = true;
} else if (is.equals("nps")) {
statNps = Integer.parseInt(tokens[i++]);

View File

@ -603,7 +603,7 @@ public class DroidChessController {
private int currMoveNr = 0;
private Move currMove = null;
private String currMoveStr = "";
private int currNodes = 0;
private long currNodes = 0;
private int currNps = 0;
private int currTime = 0;
@ -648,10 +648,27 @@ public class DroidChessController {
buf.append(pvi.pvStr);
}
final String statStr = (currDepth > 0) ?
String.format("d:%d %d:%s t:%.2f n:%d nps:%d", currDepth, currMoveNr, currMoveStr,
currTime / 1000.0, currNodes, currNps)
: "";
String statStrTmp = "";
if (currDepth > 0) {
long nodes = currNodes;
String nodesPrefix = "";
if (nodes > 100000000) {
nodes /= 1000000;
nodesPrefix = "M";
} else if (nodes > 100000) {
nodes /= 1000;
nodesPrefix = "k";
}
int nps = currNps;
String npsPrefix = "";
if (nps > 100000) {
nps /= 1000;
npsPrefix = "k";
}
statStrTmp = String.format("d:%d %d:%s t:%.2f n:%d%s nps:%d%s", currDepth, currMoveNr, currMoveStr,
currTime / 1000.0, nodes, nodesPrefix, nps, npsPrefix);
}
final String statStr = statStrTmp;
final String newPV = buf.toString();
final String newBookInfo = bookInfo;
final ArrayList<ArrayList<Move>> pvMoves = new ArrayList<ArrayList<Move>>();
@ -723,7 +740,7 @@ public class DroidChessController {
}
@Override
public void notifyStats(int id, int nodes, int nps, int time) {
public void notifyStats(int id, long nodes, int nps, int time) {
currNodes = nodes;
currNps = nps;
currTime = time;

View File

@ -29,7 +29,7 @@ public interface SearchListener {
int depth;
int score;
int time;
int nodes;
long nodes;
int nps;
boolean isMate;
boolean upperBound;
@ -37,7 +37,7 @@ public interface SearchListener {
ArrayList<Move> pv;
String pvStr = "";
public PvInfo(int depth, int score, int time, int nodes, int nps,
public PvInfo(int depth, int score, int time, long nodes, int nps,
boolean isMate, boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
this.depth = depth;
this.score = score;
@ -64,7 +64,7 @@ public interface SearchListener {
public void notifyPV(int id, Position pos, ArrayList<PvInfo> pvInfo, Move ponderMove);
/** Report search statistics. */
public void notifyStats(int id, int nodes, int nps, int time);
public void notifyStats(int id, long nodes, int nps, int time);
/** Report opening book information. */
public void notifyBookInfo(int id, String bookInfo, ArrayList<Move> moveList);