Skip to content

Commit

Permalink
IPVGO: correctly initialize board from save when there are no prior m…
Browse files Browse the repository at this point in the history
…oves (#1995)
  • Loading branch information
ficocelliguy authored Mar 6, 2025
1 parent 6530b43 commit a611c84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Go/SaveLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/Go/boardAnalysis/goAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ async function getIlluminatiPriorityMove(moves: MoveOptions, rng: number): Promi
return moves.corner()?.point ?? null;
}

const hasMoves = [moves.eyeMove(), moves.eyeBlock(), moves.growth(), moves.defend, surround].filter((m) => m).length;
const hasMoves = [moves.eyeMove(), moves.eyeBlock(), moves.growth(), moves.defend(), surround].filter(
(m) => m,
).length;
const usePattern = rng > 0.25 || !hasMoves;

if ((await moves.pattern()) && usePattern) {
Expand Down

0 comments on commit a611c84

Please sign in to comment.