diff --git a/modules/tournament/src/main/AutoPairing.scala b/modules/tournament/src/main/AutoPairing.scala index 216a714e6b9d9..81a19983452cd 100644 --- a/modules/tournament/src/main/AutoPairing.scala +++ b/modules/tournament/src/main/AutoPairing.scala @@ -22,10 +22,11 @@ final class AutoPairing( game1 = Game.make( game = chess.Game( variant = tour.variant.some, - fen = tour.position.fen.some - ).copy( - clock = tour.clock.chessClock.some - ), + fen = tour.position.fen.some) |> { g => + g.copy( + clock = tour.clock.chessClock.some, + startedAtTurn = g.player.fold(0, 1)) + }, whitePlayer = GamePlayer.white, blackPlayer = GamePlayer.black, mode = tour.mode, diff --git a/ui/analyse/src/view.js b/ui/analyse/src/view.js index bdbd4874d2048..7df5435f9fd25 100644 --- a/ui/analyse/src/view.js +++ b/ui/analyse/src/view.js @@ -206,11 +206,25 @@ function renderTurn(ctrl, turn, path) { function renderTree(ctrl, tree) { var turns = []; var initPly = ctrl.analyse.firstPly(); - for (i = 1, nb = tree.length; i < nb; i += 2) turns.push({ - turn: Math.floor((initPly + i) / 2) + 1, - white: tree[i], - black: tree[i + 1] - }); + if (initPly % 2 === 0) + for (i = 1, nb = tree.length; i < nb; i += 2) turns.push({ + turn: Math.floor((initPly + i) / 2) + 1, + white: tree[i], + black: tree[i + 1] + }); + else { + turns.push({ + turn: Math.floor(initPly / 2) + 1, + white: null, + black: tree[1] + }); + for (i = 2, nb = tree.length; i < nb; i += 2) turns.push({ + turn: Math.floor((initPly + i) / 2) + 1, + white: tree[i], + black: tree[i + 1] + }); + } + var path = treePath.default(); return turns.map(function(turn) { return renderTurn(ctrl, turn, path);