IPVGO: Add new analysis method to set a custom testing board state (#2029)

This commit is contained in:
Michael Ficocelli
2025-03-23 02:52:26 -04:00
committed by GitHub
parent de8c8691c2
commit 17ffabdfa5
11 changed files with 76 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ import { Board, BoardState, OpponentStats, Play, SimpleBoard, SimpleOpponentStat
import { Player } from "@player";
import { AugmentationName, GoColor, GoOpponent, GoPlayType, GoValidity } from "@enums";
import { Go } from "../Go";
import { Go, GoEvents } from "../Go";
import {
getNewBoardState,
getNewBoardStateFromSimpleBoard,
@@ -263,6 +263,20 @@ export function getControlledEmptyNodes(_board?: Board) {
);
}
export function setTestingBoardState(board: Board, komi?: number) {
resetBoardState(
() => {},
() => {},
GoOpponent.none,
board.length,
);
Go.currentGame.board = board;
if (komi != undefined) {
Go.currentGame.komiOverride = komi;
}
GoEvents.emit();
}
/**
* Returns all previous board states as SimpleBoards
*/