mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
IPVGO: Remove current game history from savefile, re-implement superko (#1175)
This commit is contained in:
committed by
GitHub
parent
fc8958af83
commit
1e5f7184a2
@@ -81,7 +81,7 @@ describe("Netscript Go API unit tests", () => {
|
||||
it("should correctly retrieve the current game state", async () => {
|
||||
const board = ["OXX..", ".....", ".....", "...XX", "...X."];
|
||||
const boardState = boardStateFromSimpleBoard(board, GoOpponent.Daedalus, GoColor.black);
|
||||
boardState.previousBoard = ["OX..", ".....", ".....", "...XX", "...X."];
|
||||
boardState.previousBoards = [["OX..", ".....", ".....", "...XX", "...X."]];
|
||||
Go.currentGame = boardState;
|
||||
|
||||
const result = getGameState();
|
||||
@@ -232,7 +232,7 @@ describe("Netscript Go API unit tests", () => {
|
||||
|
||||
await cheatPlayTwoMoves(mockLogger, 4, 3, 3, 4, 1, 0);
|
||||
expect(mockLogger).toHaveBeenCalledWith("Cheat failed! You have been ejected from the subnet.");
|
||||
expect(Go.currentGame.previousBoard).toEqual(null);
|
||||
expect(Go.currentGame.previousBoards).toEqual([]);
|
||||
});
|
||||
});
|
||||
describe("cheatRemoveRouter() tests", () => {
|
||||
@@ -270,7 +270,7 @@ describe("Netscript Go API unit tests", () => {
|
||||
|
||||
await cheatRemoveRouter(mockLogger, 0, 0, 1, 0);
|
||||
expect(mockLogger).toHaveBeenCalledWith("Cheat failed! You have been ejected from the subnet.");
|
||||
expect(Go.currentGame.previousBoard).toEqual(null);
|
||||
expect(Go.currentGame.previousBoards).toEqual([]);
|
||||
});
|
||||
});
|
||||
describe("cheatRepairOfflineNode() tests", () => {
|
||||
|
||||
@@ -53,4 +53,16 @@ describe("Go board analysis tests", () => {
|
||||
|
||||
expect(validity).toEqual(GoValidity.noSuicide);
|
||||
});
|
||||
|
||||
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...", ".....", ".....", ".....", "....."]);
|
||||
const validity = evaluateIfMoveIsValid(boardState, 0, 0, GoColor.white, false);
|
||||
|
||||
expect(validity).toEqual(GoValidity.boardRepeated);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,7 +41,6 @@ exports[`Check Save File Continuity GoSave continuity 1`] = `
|
||||
],
|
||||
"cheatCount": 0,
|
||||
"passCount": 0,
|
||||
"previousBoard": null,
|
||||
"previousPlayer": "White",
|
||||
},
|
||||
"previousGame": null,
|
||||
|
||||
Reference in New Issue
Block a user