diff --git a/markdown/bitburner.go.analysis.md b/markdown/bitburner.go.analysis.md index 9edbb690e..0f476d651 100644 --- a/markdown/bitburner.go.analysis.md +++ b/markdown/bitburner.go.analysis.md @@ -9,15 +9,5 @@ Tools to analyze the IPvGO subnet. **Signature:** ```typescript -analysis: { - getValidMoves(): boolean[][]; - - getChains(): (number | null)[][]; - - getLiberties(): number[][]; - - getControlledEmptyNodes(): string[]; - - getStats(): Partial>; - }; +analysis: GoAnalysis; ``` diff --git a/markdown/bitburner.go.cheat.md b/markdown/bitburner.go.cheat.md index 51352bb3a..60acef55e 100644 --- a/markdown/bitburner.go.cheat.md +++ b/markdown/bitburner.go.cheat.md @@ -9,43 +9,5 @@ Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires BitNode **Signature:** ```typescript -cheat: { - getCheatSuccessChance(): number; - removeRouter( - x: number, - y: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - playTwoMoves( - x1: number, - y1: number, - x2: number, - y2: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - - repairOfflineNode( - x: number, - y: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - - destroyNode( - x: number, - y: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - }; +cheat: GoCheat; ``` diff --git a/markdown/bitburner.go.md b/markdown/bitburner.go.md index 6d231643f..f017983bd 100644 --- a/markdown/bitburner.go.md +++ b/markdown/bitburner.go.md @@ -16,8 +16,8 @@ export interface Go | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [analysis](./bitburner.go.analysis.md) | | { getValidMoves(): boolean\[\]\[\]; getChains(): (number \| null)\[\]\[\]; getLiberties(): number\[\]\[\]; getControlledEmptyNodes(): string\[\]; getStats(): Partial<Record<[GoOpponent](./bitburner.goopponent.md), [SimpleOpponentStats](./bitburner.simpleopponentstats.md)>>; } | Tools to analyze the IPvGO subnet. | -| [cheat](./bitburner.go.cheat.md) | | { getCheatSuccessChance(): number; removeRouter( x: number, y: number, ): Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }>; playTwoMoves( x1: number, y1: number, x2: number, y2: number, ): Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }>; repairOfflineNode( x: number, y: number, ): Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }>; destroyNode( x: number, y: number, ): Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }>; } | Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires BitNode 14.2 to use. | +| [analysis](./bitburner.go.analysis.md) | | [GoAnalysis](./bitburner.goanalysis.md) | Tools to analyze the IPvGO subnet. | +| [cheat](./bitburner.go.cheat.md) | | [GoCheat](./bitburner.gocheat.md) | Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires BitNode 14.2 to use. | ## Methods diff --git a/markdown/bitburner.goanalysis.getchains.md b/markdown/bitburner.goanalysis.getchains.md new file mode 100644 index 000000000..ba1f61d4b --- /dev/null +++ b/markdown/bitburner.goanalysis.getchains.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoAnalysis](./bitburner.goanalysis.md) > [getChains](./bitburner.goanalysis.getchains.md) + +## GoAnalysis.getChains() method + +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\], \] 
+ +**Signature:** + +```typescript +getChains(): (number | null)[][]; +``` +**Returns:** + +(number \| null)\[\]\[\] + +## Remarks + +RAM cost: 16 GB (This is intentionally expensive; you can derive this info from just getBoardState() ) + diff --git a/markdown/bitburner.goanalysis.getcontrolledemptynodes.md b/markdown/bitburner.goanalysis.getcontrolledemptynodes.md new file mode 100644 index 000000000..4ade0cd1b --- /dev/null +++ b/markdown/bitburner.goanalysis.getcontrolledemptynodes.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoAnalysis](./bitburner.goanalysis.md) > [getControlledEmptyNodes](./bitburner.goanalysis.getcontrolledemptynodes.md) + +## GoAnalysis.getControlledEmptyNodes() method + +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\#", \] 
+ +**Signature:** + +```typescript +getControlledEmptyNodes(): string[]; +``` +**Returns:** + +string\[\] + +## Remarks + +RAM cost: 16 GB (This is intentionally expensive; you can derive this info from just getBoardState() ) + diff --git a/markdown/bitburner.goanalysis.getliberties.md b/markdown/bitburner.goanalysis.getliberties.md new file mode 100644 index 000000000..0e337d7e2 --- /dev/null +++ b/markdown/bitburner.goanalysis.getliberties.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoAnalysis](./bitburner.goanalysis.md) > [getLiberties](./bitburner.goanalysis.getliberties.md) + +## GoAnalysis.getLiberties() method + +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\], \] 
+ +**Signature:** + +```typescript +getLiberties(): number[][]; +``` +**Returns:** + +number\[\]\[\] + +## Remarks + +RAM cost: 16 GB (This is intentionally expensive; you can derive this info from just getBoardState() ) + diff --git a/markdown/bitburner.goanalysis.getstats.md b/markdown/bitburner.goanalysis.getstats.md new file mode 100644 index 000000000..05f37cefd --- /dev/null +++ b/markdown/bitburner.goanalysis.getstats.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoAnalysis](./bitburner.goanalysis.md) > [getStats](./bitburner.goanalysis.getstats.md) + +## GoAnalysis.getStats() method + +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, } } 
+ +**Signature:** + +```typescript +getStats(): Partial>; +``` +**Returns:** + +Partial<Record<[GoOpponent](./bitburner.goopponent.md), [SimpleOpponentStats](./bitburner.simpleopponentstats.md)>> + diff --git a/markdown/bitburner.goanalysis.getvalidmoves.md b/markdown/bitburner.goanalysis.getvalidmoves.md new file mode 100644 index 000000000..1cda65770 --- /dev/null +++ b/markdown/bitburner.goanalysis.getvalidmoves.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoAnalysis](./bitburner.goanalysis.md) > [getValidMoves](./bitburner.goanalysis.getvalidmoves.md) + +## GoAnalysis.getValidMoves() method + +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. + +**Signature:** + +```typescript +getValidMoves(): boolean[][]; +``` +**Returns:** + +boolean\[\]\[\] + +## Remarks + +RAM cost: 8 GB (This is intentionally expensive; you can derive this info from just getBoardState() ) + diff --git a/markdown/bitburner.goanalysis.md b/markdown/bitburner.goanalysis.md new file mode 100644 index 000000000..0501e3118 --- /dev/null +++ b/markdown/bitburner.goanalysis.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoAnalysis](./bitburner.goanalysis.md) + +## GoAnalysis interface + +Tools to analyze the IPvGO subnet. + +**Signature:** + +```typescript +export interface GoAnalysis +``` + +## Methods + +| Method | Description | +| --- | --- | +| [getChains()](./bitburner.goanalysis.getchains.md) |

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()](./bitburner.goanalysis.getcontrolledemptynodes.md) |

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()](./bitburner.goanalysis.getliberties.md) |

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()](./bitburner.goanalysis.getstats.md) |

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()](./bitburner.goanalysis.getvalidmoves.md) |

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.

| + diff --git a/markdown/bitburner.gocheat.destroynode.md b/markdown/bitburner.gocheat.destroynode.md new file mode 100644 index 000000000..d4e0d5710 --- /dev/null +++ b/markdown/bitburner.gocheat.destroynode.md @@ -0,0 +1,42 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoCheat](./bitburner.gocheat.md) > [destroyNode](./bitburner.gocheat.destroynode.md) + +## GoCheat.destroyNode() method + +Attempts to destroy an empty node, leaving an offline dead space that does not count as territory or provide open node access to adjacent routers. + +Success chance can be seen via ns.go.getCheatSuccessChance() + +Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet. + +**Signature:** + +```typescript +destroyNode( + x: number, + y: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| x | number | | +| y | number | | + +**Returns:** + +Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }> + +a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + +## Remarks + +RAM cost: 8 GB Requires BitNode 14.2 to use + diff --git a/markdown/bitburner.gocheat.getcheatsuccesschance.md b/markdown/bitburner.gocheat.getcheatsuccesschance.md new file mode 100644 index 000000000..caf99af11 --- /dev/null +++ b/markdown/bitburner.gocheat.getcheatsuccesschance.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoCheat](./bitburner.gocheat.md) > [getCheatSuccessChance](./bitburner.gocheat.getcheatsuccesschance.md) + +## GoCheat.getCheatSuccessChance() method + +Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. Scales with your crime success rate stat. + +Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet. + +**Signature:** + +```typescript +getCheatSuccessChance(): number; +``` +**Returns:** + +number + +## Remarks + +RAM cost: 1 GB Requires BitNode 14.2 to use + diff --git a/markdown/bitburner.gocheat.md b/markdown/bitburner.gocheat.md new file mode 100644 index 000000000..caf62f00c --- /dev/null +++ b/markdown/bitburner.gocheat.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoCheat](./bitburner.gocheat.md) + +## GoCheat interface + +Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires BitNode 14.2 to use. + +**Signature:** + +```typescript +export interface GoCheat +``` + +## Methods + +| Method | Description | +| --- | --- | +| [destroyNode(x, y)](./bitburner.gocheat.destroynode.md) |

Attempts to destroy an empty node, leaving an offline dead space that does not count as territory or provide open node access to adjacent routers.

Success chance can be seen via ns.go.getCheatSuccessChance()

Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.

| +| [getCheatSuccessChance()](./bitburner.gocheat.getcheatsuccesschance.md) |

Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. Scales with your crime success rate stat.

Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.

| +| [playTwoMoves(x1, y1, x2, y2)](./bitburner.gocheat.playtwomoves.md) |

Attempts to place two routers at once on empty nodes. Note that this ignores other move restrictions, so you can suicide your own routers if they have no access to empty ports and do not capture any enemy routers.

Success chance can be seen via ns.go.getCheatSuccessChance()

Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.

| +| [removeRouter(x, y)](./bitburner.gocheat.removerouter.md) |

Attempts to remove an existing router, leaving an empty node behind.

Success chance can be seen via ns.go.getCheatSuccessChance()

Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.

| +| [repairOfflineNode(x, y)](./bitburner.gocheat.repairofflinenode.md) |

Attempts to repair an offline node, leaving an empty playable node behind.

Success chance can be seen via ns.go.getCheatSuccessChance()

Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.

| + diff --git a/markdown/bitburner.gocheat.playtwomoves.md b/markdown/bitburner.gocheat.playtwomoves.md new file mode 100644 index 000000000..bd227e145 --- /dev/null +++ b/markdown/bitburner.gocheat.playtwomoves.md @@ -0,0 +1,46 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoCheat](./bitburner.gocheat.md) > [playTwoMoves](./bitburner.gocheat.playtwomoves.md) + +## GoCheat.playTwoMoves() method + +Attempts to place two routers at once on empty nodes. Note that this ignores other move restrictions, so you can suicide your own routers if they have no access to empty ports and do not capture any enemy routers. + +Success chance can be seen via ns.go.getCheatSuccessChance() + +Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet. + +**Signature:** + +```typescript +playTwoMoves( + x1: number, + y1: number, + x2: number, + y2: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| x1 | number | | +| y1 | number | | +| x2 | number | | +| y2 | number | | + +**Returns:** + +Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }> + +a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + +## Remarks + +RAM cost: 8 GB Requires BitNode 14.2 to use + diff --git a/markdown/bitburner.gocheat.removerouter.md b/markdown/bitburner.gocheat.removerouter.md new file mode 100644 index 000000000..145e385f7 --- /dev/null +++ b/markdown/bitburner.gocheat.removerouter.md @@ -0,0 +1,42 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoCheat](./bitburner.gocheat.md) > [removeRouter](./bitburner.gocheat.removerouter.md) + +## GoCheat.removeRouter() method + +Attempts to remove an existing router, leaving an empty node behind. + +Success chance can be seen via ns.go.getCheatSuccessChance() + +Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet. + +**Signature:** + +```typescript +removeRouter( + x: number, + y: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| x | number | | +| y | number | | + +**Returns:** + +Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }> + +a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + +## Remarks + +RAM cost: 8 GB Requires BitNode 14.2 to use + diff --git a/markdown/bitburner.gocheat.repairofflinenode.md b/markdown/bitburner.gocheat.repairofflinenode.md new file mode 100644 index 000000000..f5cfa37ff --- /dev/null +++ b/markdown/bitburner.gocheat.repairofflinenode.md @@ -0,0 +1,42 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GoCheat](./bitburner.gocheat.md) > [repairOfflineNode](./bitburner.gocheat.repairofflinenode.md) + +## GoCheat.repairOfflineNode() method + +Attempts to repair an offline node, leaving an empty playable node behind. + +Success chance can be seen via ns.go.getCheatSuccessChance() + +Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet. + +**Signature:** + +```typescript +repairOfflineNode( + x: number, + y: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| x | number | | +| y | number | | + +**Returns:** + +Promise<{ type: "move" \| "pass" \| "gameOver"; x: number \| null; y: number \| null; }> + +a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + +## Remarks + +RAM cost: 8 GB Requires BitNode 14.2 to use + diff --git a/markdown/bitburner.md b/markdown/bitburner.md index db3e9aee1..6de6b5d64 100644 --- a/markdown/bitburner.md +++ b/markdown/bitburner.md @@ -72,6 +72,8 @@ | [GangTaskStats](./bitburner.gangtaskstats.md) | Object representing data representing a gang member task. | | [GangTerritory](./bitburner.gangterritory.md) | | | [Go](./bitburner.go.md) | IPvGO api | +| [GoAnalysis](./bitburner.goanalysis.md) | Tools to analyze the IPvGO subnet. | +| [GoCheat](./bitburner.gocheat.md) | Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires BitNode 14.2 to use. | | [Grafting](./bitburner.grafting.md) | Grafting API | | [GraftingTask](./bitburner.graftingtask.md) | Faction Work | | [HackingFormulas](./bitburner.hackingformulas.md) | Hacking formulas | diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 119d4775c..4fd9f5ca5 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -4035,6 +4035,239 @@ type SimpleOpponentStats = { bonusDescription: string; }; +/** + * Tools to analyze the IPvGO subnet. + * + * @public + */ +export interface GoAnalysis { + /** + * 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. + * + * @remarks + * RAM cost: 8 GB + * (This is intentionally expensive; you can derive this info from just getBoardState() ) + */ + getValidMoves(): boolean[][]; + + /** + * 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],
+   *       ]
+   * 
+ * @remarks + * RAM cost: 16 GB + * (This is intentionally expensive; you can derive this info from just getBoardState() ) + * + */ + getChains(): (number | null)[][]; + + /** + * 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],
+   *      ]
+   * 
+ * + * @remarks + * RAM cost: 16 GB + * (This is intentionally expensive; you can derive this info from just getBoardState() ) + */ + getLiberties(): number[][]; + + /** + * 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#",
+   *   ]
+   * 
+ * + * @remarks + * RAM cost: 16 GB + * (This is intentionally expensive; you can derive this info from just getBoardState() ) + */ + getControlledEmptyNodes(): string[]; + + /** + * 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,
+   *   }
+   * }
+   * 
+ * + */ + getStats(): Partial>; +} + +/** + * Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires BitNode 14.2 to use. + * + * @public + */ +export interface GoCheat { + /** + * Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. + * Scales with your crime success rate stat. + * + * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a + * small (~10%) chance you will instantly be ejected from the subnet. + * + * @remarks + * RAM cost: 1 GB + * Requires BitNode 14.2 to use + */ + getCheatSuccessChance(): number; + /** + * Attempts to remove an existing router, leaving an empty node behind. + * + * Success chance can be seen via ns.go.getCheatSuccessChance() + * + * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a + * small (~10%) chance you will instantly be ejected from the subnet. + * + * @remarks + * RAM cost: 8 GB + * Requires BitNode 14.2 to use + * + * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + */ + removeRouter( + x: number, + y: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; + /** + * Attempts to place two routers at once on empty nodes. Note that this ignores other move restrictions, so you can + * suicide your own routers if they have no access to empty ports and do not capture any enemy routers. + * + * Success chance can be seen via ns.go.getCheatSuccessChance() + * + * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a + * small (~10%) chance you will instantly be ejected from the subnet. + * + * @remarks + * RAM cost: 8 GB + * Requires BitNode 14.2 to use + * + * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + */ + playTwoMoves( + x1: number, + y1: number, + x2: number, + y2: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; + + /** + * Attempts to repair an offline node, leaving an empty playable node behind. + * + * Success chance can be seen via ns.go.getCheatSuccessChance() + * + * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a + * small (~10%) chance you will instantly be ejected from the subnet. + * + * @remarks + * RAM cost: 8 GB + * Requires BitNode 14.2 to use + * + * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + */ + repairOfflineNode( + x: number, + y: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; + + /** + * Attempts to destroy an empty node, leaving an offline dead space that does not count as territory or + * provide open node access to adjacent routers. + * + * Success chance can be seen via ns.go.getCheatSuccessChance() + * + * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a + * small (~10%) chance you will instantly be ejected from the subnet. + * + * @remarks + * RAM cost: 8 GB + * Requires BitNode 14.2 to use + * + * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended + */ + destroyNode( + x: number, + y: number, + ): Promise<{ + type: "move" | "pass" | "gameOver"; + x: number | null; + y: number | null; + }>; +} + /** * IPvGO api * @public @@ -4180,231 +4413,12 @@ export interface Go { /** * Tools to analyze the IPvGO subnet. */ - analysis: { - /** - * 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. - * - * @remarks - * RAM cost: 8 GB - * (This is intentionally expensive; you can derive this info from just getBoardState() ) - */ - getValidMoves(): boolean[][]; - - /** - * 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],
-     *       ]
-     * 
- * @remarks - * RAM cost: 16 GB - * (This is intentionally expensive; you can derive this info from just getBoardState() ) - * - */ - getChains(): (number | null)[][]; - - /** - * 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],
-     *      ]
-     * 
- * - * @remarks - * RAM cost: 16 GB - * (This is intentionally expensive; you can derive this info from just getBoardState() ) - */ - getLiberties(): number[][]; - - /** - * 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#",
-     *   ]
-     * 
- * - * @remarks - * RAM cost: 16 GB - * (This is intentionally expensive; you can derive this info from just getBoardState() ) - */ - getControlledEmptyNodes(): string[]; - - /** - * 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,
-     *   }
-     * }
-     * 
- * - */ - getStats(): Partial>; - }; + analysis: GoAnalysis; /** * Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires BitNode 14.2 to use. */ - cheat: { - /** - * Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. - * Scales with your crime success rate stat. - * - * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a - * small (~10%) chance you will instantly be ejected from the subnet. - * - * @remarks - * RAM cost: 1 GB - * Requires BitNode 14.2 to use - */ - getCheatSuccessChance(): number; - /** - * Attempts to remove an existing router, leaving an empty node behind. - * - * Success chance can be seen via ns.go.getCheatSuccessChance() - * - * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a - * small (~10%) chance you will instantly be ejected from the subnet. - * - * @remarks - * RAM cost: 8 GB - * Requires BitNode 14.2 to use - * - * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended - */ - removeRouter( - x: number, - y: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - /** - * Attempts to place two routers at once on empty nodes. Note that this ignores other move restrictions, so you can - * suicide your own routers if they have no access to empty ports and do not capture any enemy routers. - * - * Success chance can be seen via ns.go.getCheatSuccessChance() - * - * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a - * small (~10%) chance you will instantly be ejected from the subnet. - * - * @remarks - * RAM cost: 8 GB - * Requires BitNode 14.2 to use - * - * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended - */ - playTwoMoves( - x1: number, - y1: number, - x2: number, - y2: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - - /** - * Attempts to repair an offline node, leaving an empty playable node behind. - * - * Success chance can be seen via ns.go.getCheatSuccessChance() - * - * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a - * small (~10%) chance you will instantly be ejected from the subnet. - * - * @remarks - * RAM cost: 8 GB - * Requires BitNode 14.2 to use - * - * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended - */ - repairOfflineNode( - x: number, - y: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - - /** - * Attempts to destroy an empty node, leaving an offline dead space that does not count as territory or - * provide open node access to adjacent routers. - * - * Success chance can be seen via ns.go.getCheatSuccessChance() - * - * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a - * small (~10%) chance you will instantly be ejected from the subnet. - * - * @remarks - * RAM cost: 8 GB - * Requires BitNode 14.2 to use - * - * @returns a promise that contains the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended - */ - destroyNode( - x: number, - y: number, - ): Promise<{ - type: "move" | "pass" | "gameOver"; - x: number | null; - y: number | null; - }>; - }; + cheat: GoCheat; } /**