DroidFish: Avoid terminating space character in book info strings.

This commit is contained in:
Peter Osterlund
2012-06-09 22:18:24 +00:00
parent 499ce4e6e4
commit f61785af2d

View File

@@ -145,15 +145,19 @@ public final class DroidBook {
for (BookEntry be : bookMoves) for (BookEntry be : bookMoves)
totalWeight += scaleWeight(be.weight); totalWeight += scaleWeight(be.weight);
if (totalWeight <= 0) totalWeight = 1; if (totalWeight <= 0) totalWeight = 1;
boolean first = true;
for (BookEntry be : bookMoves) { for (BookEntry be : bookMoves) {
Move m = be.move; Move m = be.move;
bookMoveList.add(m); bookMoveList.add(m);
String moveStr = TextIO.moveToString(pos, m, false); String moveStr = TextIO.moveToString(pos, m, false);
if (first)
first = false;
else
ret.append(' ');
ret.append(moveStr); ret.append(moveStr);
ret.append(':'); ret.append(':');
int percent = (int)Math.round(scaleWeight(be.weight) * 100 / totalWeight); int percent = (int)Math.round(scaleWeight(be.weight) * 100 / totalWeight);
ret.append(percent); ret.append(percent);
ret.append(' ');
} }
} }
return new Pair<String, ArrayList<Move>>(ret.toString(), bookMoveList); return new Pair<String, ArrayList<Move>>(ret.toString(), bookMoveList);