move_hash[moves[i].san] = moves[i];
}
+ // See if we're already exploring some line.
+ if (current_display_line &&
+ current_display_move < current_display_line.pretty_pv.length - 1) {
+ var first_move = current_display_line.pretty_pv[current_display_move + 1];
+ if (move_hash[first_move]) {
+ return move_hash[first_move];
+ }
+ }
+
// History and PV take priority over the display lines.
for (var i = 0; i < 2; ++i) {
var line = display_lines[i];
}
// End of dragging-related code.
-var pad = function(val, num_digits) {
- var s = val.toString();
- while (s.length < num_digits) {
- s = " " + s;
- }
- return s;
-}
-
var fmt_cp = function(v) {
if (v === 0) {
return "0.00";
}
if (score[0] === 'm') {
if (score[2]) { // Is a bound.
- return score[2] + "\u00a0M" + pad(score[1], 3);
+ return score[2] + "\u00a0M " + score[1];
} else {
- return "M" + pad(score[1], 3);
+ return "M " + score[1];
}
} else if (score[0] === 'd') {
return "TB draw";
if (score[2]) { // Is a bound.
return score[2] + "\u00a0" + fmt_cp(score[1]);
} else {
- return pad(fmt_cp(score[1]), 5);
+ return fmt_cp(score[1]);
}
}
return null;