Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPVGO: Support scripts playing against each other as each color on "No AI" boards #1917

Conversation

ficocelliguy
Copy link
Contributor

@ficocelliguy ficocelliguy commented Jan 20, 2025

Branch testable here: https://ficocelliguy.github.io/bitburner-src/

A few people in discord have asked for the ability to pit multiple IPvGO scripts against each other. This is the most recent:
https://discord.com/channels/415207508303544321/1221920484111814828/1330501717674168423

This PR adds support for making moves as the white player via the API. This can only be done on the "No AI" practice board, which gives no stats. To do this, additional promise handling was added so that the two scripts could listen for when the other script (or player via UI) has made a move.

In addition, documentation improvements and a new Go.analytics.getHistory() method were added to resolve this feedback:
Closes #1576

@Sphyxis
Copy link
Contributor

Sphyxis commented Jan 20, 2025

I look forward to implementing this in my script and so do many other people.

Copy link
Collaborator

@d0sboots d0sboots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to take a deeper look at the nextTurn stuff, which is the part with the most magic (always has been).

src/ScriptEditor/NetscriptDefinitions.d.ts Outdated Show resolved Hide resolved
src/ScriptEditor/NetscriptDefinitions.d.ts Outdated Show resolved Hide resolved
src/Go/effects/netscriptGoImplementation.ts Outdated Show resolved Hide resolved
src/Go/SaveLoad.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@d0sboots d0sboots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every time I have to review this, I have to pull the full state of how the promise stuff works back into cache. XD I think I almost have a coherent set of suggestions to make, but I'm still ruminating. Pulling everything together into a single update method is the right plan.

src/Go/boardAnalysis/goAI.ts Outdated Show resolved Hide resolved
src/Go/boardAnalysis/goAI.ts Outdated Show resolved Hide resolved
src/Go/boardAnalysis/goAI.ts Outdated Show resolved Hide resolved
src/Go/boardAnalysis/goAI.ts Outdated Show resolved Hide resolved
src/Go/boardAnalysis/goAI.ts Outdated Show resolved Hide resolved
src/Go/effects/netscriptGoImplementation.ts Outdated Show resolved Hide resolved
src/Go/effects/netscriptGoImplementation.ts Show resolved Hide resolved
src/Go/boardAnalysis/goAI.ts Outdated Show resolved Hide resolved
src/Go/boardAnalysis/goAI.ts Outdated Show resolved Hide resolved
src/Go/ui/GoGameboardWrapper.tsx Outdated Show resolved Hide resolved
d0sboots and others added 5 commits January 30, 2025 18:40
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.
This greatly simplifies the code by running everything through
handleNextTurn() (formerly makeAIMove()). The nextTurn promises for both
sides are handled identically, without special-casing. Even the built-in
AI is largely color-agnostic, with only one place that is hardcoded to
white.
This tweaked something unstable in Gameboard, the new condition is much
more stable for determining when to show the score dialog.
@d0sboots
Copy link
Collaborator

d0sboots commented Feb 2, 2025

I went through and resolved all the comments I handled in my PR, which was all of them XD

@d0sboots d0sboots merged commit c8d2c9f into bitburner-official:dev Feb 3, 2025
5 checks passed
antoinedube pushed a commit to antoinedube/bitburner-source that referenced this pull request Feb 5, 2025
…o AI" boards (bitburner-official#1917)

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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOCUMENTATION: Insufficient alternative for ns.go.analysis.getValidMoves()
3 participants