Skip to content

Cash limit, plan steps that keep purchases, island stats and building prices - #13

Merged
OGMods merged 5 commits into
mainfrom
cash-tools
Nov 3, 2026
Merged

OGMods merged 5 commits into
mainfrom
cash-tools

Conversation

@OGMods

@OGMods OGMods commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Cash limit

  • Solve for the most power a sum buys. A cash limit on Setup's Buildings tab (and --cash on the CLI) caps what turning the board in Edit into the layout may cost: buildings bought minus refunds for buildings sold; moves are free, and copies on every island count toward the price.
  • The engine tabulates the spend per island and folds it into layoutHolds. stabilize trims to the cash after stripping offline producers, the walk and polish check the budget before simulating, the standing board competes as a free seed, and buildings the cash can never buy are dropped up front.
  • One budget covers every landmass, so a budgeted run is one island: Solve all and the per-island pickers are hidden while a limit is set, and two runs are not combined.
  • Tied layouts rank by spend from the standing board everywhere they are ranked. Held layouts are checked with fitsBudget, which uses the engine's tolerance.
  • The field: it takes a plain number, e-notation or the game's suffixes, and the iOS keyboard can type them. Focusing and leaving the field doesn't change the limit. A figure under 30 minutes of income (all islands' power, at 3 s per tick) is refused.

Plan steps

  • Selling everything and rebuilding is planned only when nothing on the island survives into the target. A move onto a tile another mover holds is a swap, as the game allows.
  • Under a limit, the steps never need more cash at once than the whole change costs: a sale that pays for a build comes before it.

Island stats and prices

  • The building ribbon and Buildings tab show next-copy price, base price and copies across islands, priced with the last import's research.
  • The Island stats dialog shows power, solves ranked by power per cash, idle and overheating buildings, obstacles and clear times, the next island's price, and a card per island.
  • A share code drawn on a shipped map can be imported onto that island (two presses). Only that island's stored solve is carried over.
  • A re-import from the same run keeps the Chronon target and Time Lab plan. A Time Jump, detected by the generation count, clears both.

Testing

  • npm test (1162 passing), npm run check, npm run knip, format:check, build:solver all clean.
  • New tests cover cash-safe step order (including 60 random boards), budgeted tie ranking, fitsBudget, a carry-over limited to one island, and a re-import after a jump.
  • Golden fixtures are untouched: none of them sets a cash limit.
  • The final round of fixes (review findings and the limit floor) has not been checked in a browser.

A cash limit on Setup's Buildings tab (and --cash on the CLI) caps what
turning the board in Edit into the layout may cost: net spend, buildings
bought less refunds for buildings sold, moves free, copies on every island
counted in the price.

Net spend is a sum over building types of a function of each type's count,
so it is tabulated once per island and folded into layoutHolds (renamed
from planHolds), which every gate already calls. stabilize trims an
over-budget layout to the cash, the walk refuses an over-budget move before
simulating it, the standing board competes as a seed at no cost, and
buildings the cash plus every refund cannot buy one of are dropped up
front. One budget couples every landmass, so a budgeted run is one island
and Solve all is hidden while a limit is set.
Selling everything and rebuilding was taken whenever it was fewer steps,
which sells every building the layout keeps at a share of its price and
buys it back at the next copy's - enough to put the steps over a cash
limit the layout itself fits. It is now only planned when nothing on the
island survives into the target, where it costs the same as the walk.

A move onto a tile another mover still holds is a swap, as the game
allows, so moves never block each other and the parking tile and the
sell-and-rebuild fallback are gone, with the free-tile list behind them.
A swap draws as two arrows side by side, and step mode drops the fill
gauges as well as the state and anomaly icons.
…ame run

A fresh code from the same run - same anomaly and balance, the same Time
Lab levels, the timeline carried on rather than restarted, the islands
making at least what they made - is only catching up on progress, so the
target and the plan set against the last one stay. Anything else is a new
situation and clears both, as before.
- The building ribbon and the Buildings tab show each building's next-copy
  price, base price and copies built across every island, priced with the
  last import's research.
- Island stats (overflow menu, and a button under the island list): power,
  solves worth building ranked by power per cash, idle and overheating
  buildings, free grass, obstacles left and cleared, the next clear's time
  and the time to clear everything, the next island's price, every
  building's count and rebuild cost, and a card per island with its mix and
  power per building. Shore share only shows under Tidal.
- The island list shows each island's power where it said "Modified".
- A share code drawn on a shipped map can be imported onto that island,
  behind two presses, as well as into a new custom slot.
…tter

The limit is now kept everywhere a layout can reach the board, not only
in the search:
- The per-island pickers are hidden under a limit: one landmass from each
  of two boards that fit it may not fit it together.
- Tied layouts rank by spend from the board standing, as the engine
  ranked them, in IslandBest, buildSolveVariants and chooseSolveVariants.
- A held layout is checked with fitsBudget, the engine's own tolerance,
  and the one on screen is found again after the filter instead of
  followed by an index into the unfiltered list.
- Move steps under a limit never need more at once than the change costs
  net: a sale that pays for a build comes first.
- stabilize strips offline producers before trimming to the cash, and
  greedyPolish re-tries moves it refused for budget once prices move, and
  checks the budget before simulating.
- A budgeted launch is dropped if the island changes while its inputs are
  read, and reads the other islands' counts from the timeline's memo.

The field: focusing and leaving no longer rewrites the limit to its
3-figure display, the keyboard takes ladder suffixes on iOS, and a figure
under half an hour of income (all islands' power, 3 s a tick) is refused.

Also: Import onto an island only carries over that island's solve; a
re-import after a Time Jump clears the target and plan even once the new
run passes the old figures; the spend rule has one implementation in the
package (countsSpend), which changeSpend calls; terrain is no longer
re-scanned when a building is placed.
@OGMods
OGMods merged commit 2e2d33e into main Nov 3, 2026
3 checks passed
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.

1 participant