From 4cc49cb14f990d0b9283002028899a09190040b4 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 16 Nov 2016 20:03:08 +0100 Subject: [PATCH] Fix another off-by-one bug that was introduced while fixing the others. --- www/js/remoteglot.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index 0748dce..1f4c2a5 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -1060,10 +1060,20 @@ var update_board = function() { headline += ' after ' + last_move; } } else if (data['position']['last_move'] !== 'none') { + // Find the previous move. + var previous_move_num, previous_toplay; + if (data['position']['toplay'] == 'B') { + previous_move_num = data['position']['move_num']; + previous_toplay = 'W'; + } else { + previous_move_num = data['position']['move_num'] - 1; + previous_toplay = 'B'; + } + last_move = format_move_with_number( data['position']['last_move'], - data['position']['move_num'], - data['position']['toplay'] == 'B'); + previous_move_num, + previous_toplay == 'W'); headline += ' after ' + last_move; } else { last_move = null; -- 2.39.2