IPVGO: correctly initialize board from save when there are no prior moves (#1995)

This commit is contained in:
Michael Ficocelli
2025-03-06 14:30:12 -05:00
committed by GitHub
parent 6530b43886
commit a611c842e2
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -111,7 +111,8 @@ function loadCurrentGame(currentGame: unknown): BoardState | string {
? Math.max(0, currentGame.cheatCountForWhite || 0)
: 0;
if (!isInteger(currentGame.passCount) || currentGame.passCount < 0) return "invalid number for currentGame.passCount";
const previousBoards = typeof currentGame.previousBoard === "string" ? [currentGame.previousBoard] : [];
const previousBoards =
currentGame.previousBoard && typeof currentGame.previousBoard === "string" ? [currentGame.previousBoard] : [];
const boardState = boardStateFromSimpleBoard(board, ai);
boardState.previousPlayer = previousPlayer;