mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-09 09:07:47 +02:00
IPVGO: Ensure getValidMoves correctly handles playing as white (#2292)
This commit is contained in:
committed by
GitHub
parent
b025a4d0c1
commit
02f2f1be74
@@ -71,11 +71,16 @@ export function getNewBoardStateFromSimpleBoard(
|
||||
simpleBoard: SimpleBoard,
|
||||
priorSimpleBoard?: SimpleBoard,
|
||||
ai: GoOpponent = GoOpponent.Netburners,
|
||||
priorColor: GoColor | undefined = undefined,
|
||||
): BoardState {
|
||||
const newState = getNewBoardState(simpleBoard.length, ai, false, updatedBoardFromSimpleBoard(simpleBoard));
|
||||
if (priorSimpleBoard) {
|
||||
newState.previousBoards.push(priorSimpleBoard.join(""));
|
||||
}
|
||||
|
||||
if (priorColor) {
|
||||
newState.previousPlayer = priorColor;
|
||||
} else if (priorSimpleBoard) {
|
||||
// Identify the previous player based on the difference in pieces
|
||||
const priorWhitePieces = priorSimpleBoard.join("").match(/O/g)?.length ?? 0;
|
||||
const priorBlackPieces = priorSimpleBoard.join("").match(/X/g)?.length ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user