mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 18:50:56 +02:00
IPVGO: Add history, and details to status, to go API (#1348)
This commit is contained in:
committed by
GitHub
parent
30a6419b11
commit
cf48d666f5
@@ -612,6 +612,15 @@ export function boardStringFromBoard(board: Board): string {
|
||||
* ```
|
||||
*/
|
||||
export function boardFromBoardString(boardString: string): Board {
|
||||
const simpleBoardArray = simpleBoardFromBoardString(boardString);
|
||||
|
||||
return boardFromSimpleBoard(simpleBoardArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Slices a string representation of a board into an array of strings representing the rows on the board
|
||||
*/
|
||||
export function simpleBoardFromBoardString(boardString: string): SimpleBoard {
|
||||
// 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("");
|
||||
@@ -621,7 +630,7 @@ export function boardFromBoardString(boardString: string): Board {
|
||||
.fill("")
|
||||
.map((_, index) => boardTiles.slice(index * boardSize, (index + 1) * boardSize).join(""));
|
||||
|
||||
return boardFromSimpleBoard(simpleBoardArray);
|
||||
return simpleBoardArray;
|
||||
}
|
||||
|
||||
/** Creates a board object from a simple board. The resulting board has no analytics (liberties/chains) */
|
||||
|
||||
Reference in New Issue
Block a user