bitburner-src/markdown/bitburner.goanalysis.md

3.4 KiB

Home > bitburner > GoAnalysis

GoAnalysis interface

Tools to analyze the IPvGO subnet.

Signature:

export interface GoAnalysis 

Methods

Method Description
getChains()

Returns an ID for each point. All points that share an ID are part of the same network (or "chain"). Empty points are also given chain IDs to represent continuous empty space. Dead nodes are given the value null.

The data from getChains() can be used with the data from getBoardState() to see which player (or empty) each chain is

For example, a 5x5 board might look like this. There is a large chain #1 on the left side, smaller chains 2 and 3 on the right, and a large chain 0 taking up the center of the board.

 [ [ 0,0,0,3,4], [ 1,0,0,3,3], [ 1,1,0,0,0], [null,1,0,2,2], [null,1,0,2,5], ] 

getControlledEmptyNodes()

Returns 'X', 'O', or '?' for each empty point to indicate which player controls that empty point. If no single player fully encircles the empty space, it is shown as contested with '?'. "#" are dead nodes that are not part of the subnet.

Filled points of any color are indicated with '.'

In this example, white encircles some space in the top-left, black encircles some in the top-right, and between their routers is contested space in the center:

 [ "OO..?", "OO.?.", "O.?.X", ".?.XX", "?..X#", ] 

getLiberties()

Returns a number for each point, representing how many open nodes its network/chain is connected to. Empty nodes and dead nodes are shown as -1 liberties.

For example, a 5x5 board might look like this. The chain in the top-left touches 5 total empty nodes, and the one in the center touches four. The group in the bottom-right only has one liberty; it is in danger of being captured!

 [ [-1, 5,-1,-1, 2], [ 5, 5,-1,-1,-1], [-1,-1, 4,-1,-1], [ 3,-1,-1, 3, 1], [ 3,-1,-1, 3, 1], ] 

getStats()

Displays the game history, captured nodes, and gained bonuses for each opponent you have played against.

The details are keyed by opponent name, in this structure:

 { : { wins: number, losses: number, winStreak: number, highestWinStreak: number, favor: number, bonusPercent: number, bonusDescription: string, } } 

getValidMoves()

Shows if each point on the board is a valid move for the player.

The true/false validity of each move can be retrieved via the X and Y coordinates of the move. const validMoves = ns.go.analysis.getValidMoves();

const moveIsValid = validMoves[x][y];

Note that the [0][0] point is shown on the bottom-left on the visual board (as is traditional), and each string represents a vertical column on the board. In other words, the printed example above can be understood to be rotated 90 degrees clockwise compared to the board UI as shown in the IPvGO subnet tab.