IPVGO: Add support to netscript API for game state, current player, and alternate ways to check/wait on AI turn (#1142)

This commit is contained in:
Michael Ficocelli
2024-03-19 14:07:15 -04:00
committed by GitHub
parent 6aaeb6b59e
commit d81358c80f
22 changed files with 541 additions and 308 deletions
+8 -1
View File
@@ -1,7 +1,7 @@
import type { Board, BoardState, PointState } from "../Types";
import { Player } from "@player";
import { GoOpponent, GoColor } from "@enums";
import { GoOpponent, GoColor, GoPlayType } from "@enums";
import { newOpponentStats } from "../Constants";
import { getAllChains, getPlayerNeighbors } from "./boardAnalysis";
import { getKomi } from "./goAI";
@@ -46,6 +46,13 @@ export function endGoGame(boardState: BoardState) {
if (boardState.previousPlayer === null) {
return;
}
Go.nextTurn = Promise.resolve({
type: GoPlayType.gameOver,
x: null,
y: null,
success: true,
});
boardState.previousPlayer = null;
const statusToUpdate = getOpponentStats(boardState.ai);
statusToUpdate.favor = statusToUpdate.favor ?? 0;