mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
This is a big change with a *lot* of moving parts. The largest part of it is enabling scripts to `playAsWhite` as a parameter to many Go functions. In the implementation, this involved a significant rewrite of `opponentNextTurn` promise handling. A number of other changes and bugfixes are included: * Fixes the issue where handicap stones are added on game load. * Better typing for error callbacks. * Throw errors instead of deadlocking on bad cheat usage. * Return always-resolved gameOver promise after game end * Added a new `resetStats` api function. --------- Co-authored-by: David Walker <d0sboots@gmail.com>
1.3 KiB
1.3 KiB
Home > bitburner > Go > opponentNextTurn
Go.opponentNextTurn() method
Returns a promise that resolves with the success or failure state of your last move, and the AI's response, if applicable. x:0 y:0 represents the bottom-left corner of the board in the UI.
Signature:
opponentNextTurn(
logOpponentMove?: boolean,
playAsWhite = false,
): Promise<{
type: "move" | "pass" | "gameOver";
x: number | null;
y: number | null;
}>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| logOpponentMove | boolean | (Optional) optional, defaults to true. if false prevents logging opponent move |
| playAsWhite | (not declared) | (Optional) optional. If true, waits to get the next move the black player makes. Intended to be used when playing as white when the opponent is set to "No AI" |
Returns:
Promise<{ type: "move" | "pass" | "gameOver"; x: number | null; y: number | null; }>
a promise that contains if your last move was valid and successful, the opponent move's x and y coordinates (or pass) in response, or an indication if the game has ended
Remarks
RAM cost: 0 GB