From fe3e8fb3482ef8fb9223cd0ea4964a69fa84652a Mon Sep 17 00:00:00 2001 From: Michael Ficocelli Date: Wed, 5 Jun 2024 20:51:01 -0400 Subject: [PATCH] IPVGO: Fix crash caused by malformed previous move formatting (#1360) --- src/Go/boardAnalysis/boardAnalysis.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Go/boardAnalysis/boardAnalysis.ts b/src/Go/boardAnalysis/boardAnalysis.ts index c3d8b097c..b02b8399e 100644 --- a/src/Go/boardAnalysis/boardAnalysis.ts +++ b/src/Go/boardAnalysis/boardAnalysis.ts @@ -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); }