IPVGO: Fix crash caused by malformed previous move formatting (#1360)

This commit is contained in:
Michael Ficocelli 2024-06-05 20:51:01 -04:00 committed by GitHub
parent d9e8161a64
commit fe3e8fb348
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -615,9 +615,11 @@ export function boardFromBoardString(boardString: string): Board {
// Turn the SimpleBoard string into a string array, allowing access of each point via indexes e.g. [0][1]
const boardSize = Math.round(Math.sqrt(boardString.length));
const boardTiles = boardString.split("");
const simpleBoardArray = Array(boardSize).map((_, index) =>
boardTiles.slice(index * boardSize, (index + 1) * boardSize).join(""),
);
// Split the single board string into rows of length equal to the board width
const simpleBoardArray = Array(boardSize)
.fill("")
.map((_, index) => boardTiles.slice(index * boardSize, (index + 1) * boardSize).join(""));
return boardFromSimpleBoard(simpleBoardArray);
}