Repository navigation
Add an upgrade plan: solve for tiers you are about to buy - #4
Merged
Merged
Conversation
List up to three upgrades in buying order and a run solves for the tiers at the end of the plan, while every layout it keeps also runs at today's tiers and after each step. The layout comes back at today's tiers, so what is on screen is what can be built now. It is optimal only at the last step: until every upgrade is bought, the layout keeps room for what is coming and makes less power than a plain solve. - Solver: SolveOptions.upgradePlan holds each kept layout to the plan's rosters at every gate that admits a layout (best record, repair, composition, pruning, right-sizing, ties, stabilize), and seeds from today's roster as well as the target's. No plan, no change: the fixtures regenerate byte for byte. - resolveUpgradePlan turns the ordered steps into a target and the rosters along the way, skipping steps already bought. - Setup: a row at the top of the Buildings tab opens the plan dialog. Its picker offers only unlocked buildings with a tier left to buy, steps are reordered in place, and each roster card marks its planned tier. - Readout: an "After upgrades" line for any board on screen, naming the first step that would overheat it; buildings idle today but needed after the plan are listed as "Kept for upgrades" rather than Idle. - Under a plan, runs are compared on power after the plan. The plan is recorded per solve rather than folded into the solve signature, so editing it does not discard stored solves.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Players asked to solve for an upgrade they are about to buy without having to rebuild afterwards. This adds an upgrade plan: up to three upgrades in buying order. A run solves for the tiers at the end of the plan, and every layout it keeps must also run at today's tiers and after each step. The layout comes back at today's tiers, so what is on screen is what can be built now.
It is optimal only at the last step. Until every upgrade is bought, the layout keeps room for what is coming and makes less power than a plain solve. The dialog says so up front.
Why
Measured over the eight maps (8s solves, two seeds, four progression stages), an upgrade can break a standing layout, and which way depends on the role:
A layout solved under a plan never overheated at any step, in any run. It reached 97–100% of the best target power for generator upgrades and ~100% for reactor ones, at 57–98% of today's best power. Cooler upgrades gain nothing: the best layout that also runs today is today's layout. The order matters: requiring every buying order kept 31–59% of the target power, a fixed order 59–99%. So the plan is ordered.
Changes
@reactor2/solver):SolveOptions.upgradePlan. Every point where the search accepts a layout as stable also requires it to run at each plan step (best record, repair, composition, pruning, right-sizing, tied layouts,stabilize). The search also builds a starting layout from today's roster; without that, cooler plans came out far worse.resolveUpgradePlanturns the ordered steps into a target plus the rosters along the way, skipping steps already bought.resultPlanKey), and the plan is kept out of the stored-solve signature, so editing it does not discard other islands' saved solves.docs/SOLVER.md(design note and measurements), the folderCLAUDE.mdguides, README.Testing
npm test: 854 passing, 25 of them new. They cover the resolver, stability at every step on three plans,evaluatePlan, ranking by power after the plan, and the dialog's plan actions. Without a plan, the same solves overheat, so the step-stability tests have teeth.npm run fixturesregenerates byte for byte; the path without a plan is unchanged.npm run checkandnpm run knipare clean.