IPVGO: Record full history to avoid infinite ko capture loops on larger boards (#1299)

This commit is contained in:
Michael Ficocelli
2024-06-02 23:19:26 -04:00
committed by GitHub
parent 2f7950b49c
commit d9f04203cf
7 changed files with 61 additions and 28 deletions
+2 -2
View File
@@ -92,9 +92,9 @@ describe("Netscript Go API unit tests", () => {
describe("getGameState() tests", () => {
it("should correctly retrieve the current game state", async () => {
const board = ["OXX..", ".....", ".....", "...XX", "...X."];
const board = ["OXX..", ".....", "..#..", "...XX", "...X."];
const boardState = boardStateFromSimpleBoard(board, GoOpponent.Daedalus, GoColor.black);
boardState.previousBoards = [["OX..", ".....", ".....", "...XX", "...X."]];
boardState.previousBoards = ["OX.........#.....XX...X."];
Go.currentGame = boardState;
const result = getGameState();
+4 -4
View File
@@ -57,10 +57,10 @@ describe("Go board analysis tests", () => {
it("identifies invalid moves from repeat", async () => {
const board = [".X...", ".....", ".....", ".....", "....."];
const boardState = boardStateFromSimpleBoard(board);
boardState.previousBoards.push([".X...", ".....", ".....", ".....", "....."]);
boardState.previousBoards.push([".X...", ".....", ".....", ".....", "....."]);
boardState.previousBoards.push([".X...", ".....", ".....", ".....", "....."]);
boardState.previousBoards.push(["OX...", ".....", ".....", ".....", "....."]);
boardState.previousBoards.push(".X.......................");
boardState.previousBoards.push(".X.......................");
boardState.previousBoards.push(".X.......................");
boardState.previousBoards.push("OX.......................");
const validity = evaluateIfMoveIsValid(boardState, 0, 0, GoColor.white, false);
expect(validity).toEqual(GoValidity.boardRepeated);