IPVGO: Prevent issues caused by resetting the board while the go AI is in flight (#1608)

This commit is contained in:
Michael Ficocelli
2024-09-07 21:33:49 -04:00
committed by GitHub
parent 4f426e1b20
commit 2a5b0ca4e9
6 changed files with 32 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ import { Player } from "@player";
import { AugmentationName, GoColor, GoOpponent, GoPlayType, GoValidity } from "@enums";
import { Go, GoEvents } from "../Go";
import { getNewBoardState, makeMove, passTurn, updateCaptures, updateChains } from "../boardState/boardState";
import { makeAIMove } from "../boardAnalysis/goAI";
import { makeAIMove, resetAI } from "../boardAnalysis/goAI";
import {
evaluateIfMoveIsValid,
getControlledSpace,
@@ -292,6 +292,7 @@ export function resetBoardState(
}
Go.currentGame = getNewBoardState(boardSize, opponent, true);
resetAI(false);
GoEvents.emit(); // Trigger a Go UI rerender
logger(`New game started: ${opponent}, ${boardSize}x${boardSize}`);
return simpleBoardFromBoard(Go.currentGame.board);