bitburner-official / bitburner-src

Bitburner source code.
Other
801 stars 264 forks source link

Manually unborking Go API documentation until it's unborked #1149

Closed User670 closed 7 months ago

User670 commented 7 months ago

https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.go.md

The markdown is messed up, but I'm not sure how I would fix the source code, so here's a temporary thing that I can read while someone gets to fix it.

Looks like the code block (which someone made with triple backticks) broke the table; any literal line breaks in the markdown source code made the markdown parser think it should end the table.


Home > bitburner > Go

Go interface

IPvGO api

Signature:

export interface Go 

Properties

Property Modifiers Type Description
analysis { getValidMoves(): boolean[][]; getChains(): (number | null)[][]; getLiberties(): number[][]; getControlledEmptyNodes(): string[]; } Tools to analyze the IPvGO subnet.
cheat { getCheatSuccessChance(): number; removeRouter( x: number, y: number, ): Promise<{ type: "invalid" | "move" | "pass" | "gameOver"; x: number; y: number; success: boolean; }>; playTwoMoves( x1: number, y1: number, x2: number, y2: number, ): Promise<{ type: "invalid" | "move" | "pass" | "gameOver"; x: number; y: number; success: boolean; }>; repairOfflineNode( x: number, y: number, ): Promise<{ type: "invalid" | "move" | "pass" | "gameOver"; x: number; y: number; success: boolean; }>; destroyNode( x: number, y: number, ): Promise<{ type: "invalid" | "move" | "pass" | "gameOver"; x: number; y: number; success: boolean; }>; } Illicit and dangerous IPvGO tools. Not for the faint of heart. Requires Bitnode 14.2 to use.

Methods

Method Description
getBoardState()

Retrieves a simplified version of the board state. "X" represents black pieces, "O" white, and "." empty points. "#" are dead nodes that are not part of the subnet. (They are not territory nor open nodes.)

For example, a 5x5 board might look like this:

[
"XX.O.",
"X..OO",
".XO..",
"XXO.#",
".XO.#",
]

Each string represents a vertical column on the board, and each character in the string represents a point.

Traditional notation for Go is e.g. "B,1" referring to second ("B") column, first rank. This is the equivalent of index [1][0].

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.

getOpponent() Returns the name of the opponent faction in the current subnet.
makeMove(x, y) Make a move on the IPvGO subnet gameboard, and await the opponent's response. x:0 y:0 represents the bottom-left corner of the board in the UI.
passTurn()

Pass the player's turn rather than making a move, and await the opponent's response. This ends the game if the opponent passed on the previous turn, or if the opponent passes on their following turn.

This can also be used if you pick up the game in a state where the opponent needs to play next. For example: if BitBurner was closed while waiting for the opponent to make a move, you may need to call passTurn() to get them to play their move on game start.

resetBoardState(opponent, boardSize)

Gets new IPvGO subnet with the specified size owned by the listed faction, ready for the player to make a move. This will reset your win streak if the current game is not complete and you have already made moves.

Note that some factions will have a few routers on the subnet at this state.

opponent is "Netburners" or "Slum Snakes" or "The Black Hand" or "Daedalus" or "Illuminati",

d0sboots commented 7 months ago

@ficocelliguy

We'll fix this in the source code, things get ugly if you start committing changes to generated files.

User670 commented 7 months ago

1142 fixed it.