diff --git a/CLAUDE.md b/CLAUDE.md index 5b7cbbd..f95b71d 100755 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -219,7 +219,7 @@ down**, and after `npm run fixtures` **read the diff**. See ## State layer (`src/lib/state/`, Svelte 5 runes) -Six singleton classes, each exported as a ready-made instance, split by what the +Seven singleton classes, each exported as a ready-made instance, split by what the state **is** rather than by which component reads it. They reference each other directly rather than through events/props — this is a small enough app that singletons + direct calls are the whole store layer. What keeps that from @@ -228,7 +228,8 @@ becoming a knot is that the references form a **strict DAG**: ``` layout -> (nothing) config -> (nothing) viewport -> (nothing) editor -> layout -solver -> config, layout ui -> config, layout, solver, viewport +solver -> config, layout timeline -> config, layout +ui -> config, layout, solver, timeline, viewport ``` ## Assets and the deployed base diff --git a/docs/SOLVER.md b/docs/SOLVER.md index 713d76f..2a67ae4 100644 --- a/docs/SOLVER.md +++ b/docs/SOLVER.md @@ -227,6 +227,18 @@ the unchanged search across three seeds, because `powerPerTile` orders a greedy later stages rewrite, so skewing it toward the coast mostly changes which tiles are claimed first. Don't re-attempt either without a wider measurement. +**What did pay is a second seed with the top reactor one tier down** (`TIER_STEP`, the ×1.25 every +reactor steps by), rewritten in the real roster's buildings and kept when it stabilizes higher — +the move an upgrade plan already makes with today's tiers, and how it was found: a player's plan +run beat their plain one. On their board (Tidal legacy plus research) that seed stabilizes at +15.39AD against 13.95AD and wins every attempt; over 48 attempts at 20s the median rose from +19.58–19.63AD to 19.69–19.74AD and the worst from 19.32–19.41AD to 19.42–19.53AD, the best +unchanged. On the shipped maps it wins the seed comparison on every main island and moves nothing at the end: +maps 3, 5–8 under both Tidal variants, 30 attempts each, medians within ±0.04AD in both directions; +under the base rules the same, and on the player's board with the anomaly off the runs were +identical. So it is gated to a terrain bonus, where it was measured to help, and costs one seed +construction there; a plan run already has its own second seed and skips it. + `role_isolation` is resolved in `simulateIsland`, the one place a whole layout is in hand. It copies the placement into `ctx.ratedLayout` — held by the island, not allocated per call — re-rates the affected role's tiles and reads every figure through that. Two details are load-bearing: the @@ -857,10 +869,10 @@ Import dialog to see the board. code writer all three paths go through and it always passes `blueprintRules`, so the app's preview rates a CLI layout the way the run did rather than under the reader's own timeline — a coast-hugging Tidal board would otherwise come back at roughly its baseline figure with nothing -saying why. The research table it writes is **empty rather than absent**, which is a different -claim and a true one: the CLI solves at full unlocks and no Time Lab, and there is no flag for one, -so "the author had no research" is exactly what it knows, where an absent section would mean "rules -unknown". `--anomaly` also tags the filename (`test_4_tidal_ascendancy.txt`) and every header names +saying why. The research table it writes is the run's: a `--code` board's own, otherwise **empty +rather than absent**, which is a different claim and a true one — a shipped map is solved with no +Time Lab, so "the author had no research" is exactly what it knows, where an absent section would +mean "rules unknown". `--anomaly` also tags the filename (`test_4_tidal_ascendancy.txt`) and every header names the timeline, because a `solves/` directory or a session scrollback holding three timelines is otherwise unreadable from the outside — the same argument `formatNumberForFilename` makes about the power figure. The tag is the full id, so a filename pastes straight back into the flag that @@ -869,7 +881,14 @@ matches the optional tail, since that regex is what finds the previous ids: a ta could not see would restart numbering at 1 and overwrite an untagged run. `--attempts` runs a batch session: N whole solves through a worker pool, with a leaderboard of -distinct layouts at the end. Ctrl-C stops it and still prints the report. +distinct layouts at the end and the worst, median and best of every attempt — the spread is what +tells two settings apart when both reach the same best. Ctrl-C stops it and still prints the report. + +Three flags reproduce a player's setup rather than a shipped one. `--code BLUEPRINT` solves a +pasted board, taking its anomaly (unless `--anomaly` is given) and its Time Lab research from the +code's rules section. `--tier ID=LEVEL` holds a building below its last tier, and `--plan +ID=LEVEL` adds an upgrade-plan step, in buying order and resolved by `resolveUpgradePlan` exactly +as the app does; both count levels from 1, like the app's tier buttons. Cores are spent on two axes and the flags pick which. A **run** farms its islands out to the pool, each with its own slice (`islandBudgetsS`) of the budget. When every island has a worker of its diff --git a/docs/game-export.md b/docs/game-export.md index 065224a..eba2e5c 100644 --- a/docs/game-export.md +++ b/docs/game-export.md @@ -128,9 +128,12 @@ Primitive encodings (what .NET's `BinaryWriter` writes, UTF-8): | `int16` | 2, little-endian, signed | | `uint16` | 2, little-endian | | `int32` | 4, little-endian, signed | +| `int64` | 8, little-endian, signed | +| `double` | 8, IEEE 754, little-endian | | `string` | 7-bit-encoded length (LEB128), then that many UTF-8 bytes | -Six sections, always present, always in this order: +Seven sections, always present, always in this order (section 7 since game +1.1.11; an older code ends after section 6): | # | Section | Contents | | --- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------- | @@ -140,6 +143,7 @@ Six sections, always present, always in this order: | 4 | Research | `uint16` count · per `ResearchSO`, all domains: `string` research id · `uint16` level | | 5 | Research in progress | `uint16` count · per entry: `string` research id · `uint16` level it will reach · `int32` seconds left | | 6 | Obstacles being cleared | `uint16` count · per entry: `int16` x · `int16` y · `int32` seconds left | +| 7 | Timeline | see 4.5 | Rules: @@ -197,6 +201,46 @@ y = minY + 1 : grass cooler2 generator7 has the cell bytes `00 01 02 01 07 08`. +### 4.5 Timeline + +Where the player's timeline stands, for the optimizer's Chronon tools. In this +order: + +| Field | Type | Meaning | +| ------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| Exported at | `int64` | Moment of export, Unix seconds, UTC: server time once the game has synced, the device clock otherwise | +| Chronon balance | `int64` | Chronons held, unspent | +| Timeline energy | `double` | `TimelineEnergyProduced`, online + offline: the `E` of the award | +| Timeline elapsed | `int64` | Seconds since the timeline began, on the game's internal clock | +| Jump award now | `int64` | The game's own award for a jump now, **without** the first-entry bonus; 0 at zero energy | +| Anomalies entered | `uint16` count · count × `string` | Anomalies whose first-entry bonus is spent. Always `tidal_ascendancy`, never `tidal_ascendancy_legacy`: the bonus belongs to the anomaly | +| Timeline generation | `int32` | Time Jumps completed, 0 before the first | +| Cash | `double` | The raw signed balance: negative while building on credit | +| Research points | `double` | Research points held | +| Stamp source | `byte` | Which clock wrote "Exported at": 0 server time, 1 the device clock (the game had not synced) | + +Cash and research points were appended after the first samples, and the stamp +source after them, so a code that ends at any of those fields is a valid, older +section 7. Cash goes **below zero** on +build credit: a purchase is allowed while `cash − cost ≥ −limit`, the limit set by +the Build Credit research in section 4. The caps on both balances also come from +research, and are multiplied while Rush Hour runs. + +The award, as the developer gave it: + +``` +Chronons = max(1, floor(97.34 × (E / 2.82e16)^0.135 × M)) + B +``` + +`M` is the Chronon Reactor multiplier (its level is in section 4), `B` is 88 +on the first entry into an anomaly and 0 otherwise. A jump is allowed once the +award without `B` reaches `min(5000, round(88 × 1.15^generation))`, midpoint +rounded away from zero. + +For a save older than the Time Jump feature that has not jumped yet, timeline +energy and elapsed are counted from its first launch after that update; the +two still agree, so energy per second is right. + ## 5. Versioning - The format version is the digit in the `R2X1.` prefix. @@ -235,6 +279,40 @@ first three real exports came to 2,347–2,460 characters. The roster also lists `research_building_tidal_plant`, a building the optimizer does not carry yet. The reader matches ids exactly and skips unknown ones. +- **The 1.1.11 timeline samples** are in `tests/gameExports/` as + `gen__city.txt`, the third round, ending with the + clock byte. A `_server` file is the same save stamped by server time (the + editor's sync fed from an NTP clock), the rest by the device clock. + `owner_editor_save` is kept from the second round as the one real code that + ends at research points. Each one's jump award matches the formula in 4.5. + One of them, `gen1_cryo_city41`, has a building on the transformer cell of + areas 6, 7 and 8; the importer drops those three. +- **The power is right to under 100 parts per million.** `gen2_city52_9c43e4b7` + is a player's save, exported repeatedly with the same boards. The energy the + game added between two exports, over the time between, is its real rate, and + the simulator's power for those boards, as energy per 3-second tick, lands + within 25–66 ppm of it whenever the gap was offline. `editor_current_save`, + the same save after some play in the editor, comes out 229 ppm slower: the + online tick drift below, measured. +- **An editor export runs about 10 s ahead.** On that same save the projected + next Chronon arrived 10–11 s before the game's, with the browser's clock + correct. The code came from the developer's Unity editor, which loaded the + save and credited its offline income by its own game clock — and the game's + anti-tampering can hold that clock off real time. So the editor's copy was 10 + s ahead of the player's phone, and the projection was right for the copy it + was given. A player's own export has energy and stamp from one copy, so the + stamp should stay **server time**: that is the real moment the energy + describes, where a game-clock stamp would carry the anti-tampering offset into + every projection. The weak spot is the unsynced fallback to the device clock. +- **The game runs slow while it is open (a game bug, being fixed).** Its + production tick waits 3 s after the previous one and the wait ends on the next + frame, so each tick runs a few milliseconds long: about 0.3% slow at 60 fps + (~10 s an hour), 0.5% at 30 fps, and more on frame hitches. Offline time is + counted in real time. So a projection on the real clock pulls ahead of the game + by that fraction of the time it has been open since the export — the + projection is right and the game drifts. The developer also suspects a short + focus loss credits the gap since the last autosave (every 15 s) rather than + since the pause. Neither is modelled here: both are the game's to fix. - **A code can pick up stray characters when pasted.** One sample ended in a stray `ś`. The reader drops anything outside the base64url alphabet before decoding; a code damaged in the middle still fails, at the inflate. diff --git a/docs/game-logic.md b/docs/game-logic.md index bd6367b..ed120d8 100755 --- a/docs/game-logic.md +++ b/docs/game-logic.md @@ -392,13 +392,33 @@ apply them, and the cooling network. The in-game description text is not the authority: several of its lines have more than one consistent reading, and where it and the code differ, what is written here is the code. +### What a Time Jump pays + +A jump pays Chronons for the energy the timeline produced, online and offline: + +``` +Chronons = max(1, floor(97.34 × (E / 2.82e16)^0.135 × M)) + B +``` + +`M` is the Chronon Reactor research's multiplier (×1.05 to ×1.25), and `B` is +88 the first time a timeline runs under a given anomaly, otherwise 0 — added +after the multiplier, not through it. At zero energy the award is 0. A jump is +allowed once the award without `B` reaches +`min(5000, round(88 × 1.15^jumps completed))`: 88, 101, 116, 134 … + +**Layout power barely moves the count.** At an exponent of 0.135, doubling a +whole timeline's energy pays about 9.8% more Chronons; what layout power buys is +_when_ the next one arrives. The board's power is energy per 3-second tick. +`packages/solver/src/data/chronons.ts` holds the formula. + --- ## Time Lab Research -Eleven researches exist; **three** of them change a building's figures, and the -other eight move research income, research time, Chronons, obstacle-removal -cost, energy sale price and building prices — all decided before a board is +Twelve researches exist; **three** of them change a building's figures, and the +other nine move research income, research time, Chronons, obstacle-removal +cost, energy sale price, building prices and the City level a timeline starts +at — all decided before a board is laid out, so none can change which layout is best. | research | scales | levels (×) | diff --git a/packages/solver/CLAUDE.md b/packages/solver/CLAUDE.md index c80f468..68d2e68 100644 --- a/packages/solver/CLAUDE.md +++ b/packages/solver/CLAUDE.md @@ -11,11 +11,11 @@ The app-side half — how `layoutState`, `configState`, `AnomalySelector` and ### Time Lab research -`PRESTIGE_UPGRADES` (`data/prestige.ts`) carries **three** of the game's eleven +`PRESTIGE_UPGRADES` (`data/prestige.ts`) carries **three** of the game's twelve researches: Absolute Zero (cooler cooling), Infinite Grid (generator and wind -turbine stats) and Stellar Forge (reactor heat). The other eight move research -income, research time, chronons, obstacle-removal, energy sale price and -building prices — all +turbine stats) and Stellar Forge (reactor heat). The other nine move research +income, research time, chronons, obstacle-removal, energy sale price, +building prices and the City level a timeline starts at — all decided _before_ the solver is handed a board, so none can change which layout is best. The file names them so it is clear they were read and dismissed. @@ -79,6 +79,39 @@ by `HeatProducerBuildingSO`. That is why Infinite Grid goes out of its way to name turbines. The rule is "every heat producer", and a reactor is the only one the game ships, so it is modelled as reactors. +### Building prices + +`data/buildingPrices.ts` is what a building costs in the game: `base × +scaler^copies × (1 − Construction Permits) × (1 − Quantum Replicator)`, the +copies counted across all islands and the scaler 1.14 until Standardized Builds +lowers it, and a sale refunds Salvage Protocols' share of the **current** price. +The research tables are hand-transcribed from `tools/data/progression.json`; +the base prices are the catalogue's `price`. Salvage Protocols' level 0 (50%) is +an assumption — the record starts at level 1 — and says so. The rules were +confirmed by the player; moves are free. + +### The Time Lab table + +`data/timeLab.ts` carries all twelve Time Lab researches with each level's +Chronon cost — the planner's price list — where `PRESTIGE_UPGRADES` carries only +the three a layout feels. Hand-transcribed from the extractor's record like that +table; where the two overlap they must agree, which `tests/timeLab.test.ts` +enforces, and Chronon Reactor's values must match `chronons.ts`'s multiplier +(kept apart there to avoid an import cycle). `gameId` is the key a game export +files a research under — the extractor's id for all but Chrono Seed, which +exports as `TimeLabSkipCityResearchSO`. + +### Chronons + +`data/chronons.ts` is the one place the game's Chronon award lives: the formula, +its inverse (`energyForAward`), the jump threshold by generation, the first-entry +bonus and `projectTimeline`, which runs a game export's section 7 forward from its +`exportedAt`. Chronon Reactor's multiplier is carried there rather than in +`PRESTIGE_UPGRADES`, which holds only research a layout can feel. Island power is +energy **per tick** (`TICK_SECONDS` = 3). `tests/chronons.test.ts` holds the +formula to the award the game wrote into every 1.1.11 sample, and the projection +to a live reading taken on a player's save. + ### Anomalies Prestiging also picks an **anomaly** that changes the rules for the whole next @@ -423,7 +456,7 @@ CoolingPerSec` — it is what a cooler is worth and what the game shows for it, they are bought with Chronons, survive a Time Jump, and stack with whatever anomaly is running — **multiplicatively**, so a generator under Singularity Isolation with Infinite Grid maxed is rated x8. The extractor's record covers -all eleven Time Lab upgrades; the three a layout can see are **Stellar Forge** +all twelve Time Lab upgrades; the three a layout can see are **Stellar Forge** (every heat producer, so reactors), **Infinite Grid** (generators _and_ wind turbines), and **Absolute Zero** (every cooler), each ten levels of `BonusPercentage`. Absolute Zero and Infinite Grid share one curve, 0.1 to 1.0 diff --git a/packages/solver/bin/report.ts b/packages/solver/bin/report.ts index 2da501e..9691ea3 100644 --- a/packages/solver/bin/report.ts +++ b/packages/solver/bin/report.ts @@ -210,6 +210,18 @@ export function printSessionReport(report: SessionReport): void { if (rules) console.log(rules); console.log(rule); console.log(`Estimated max: ${formatNumberPair(report.estimatedMaxPower)}`); + // The spread, not only the best: the top layouts say what a session *can* + // find, and two settings that both reach the same best can still differ in + // how often they get there. + if (report.powers.length) { + const sorted = [...report.powers].sort((a, b) => a - b); + const median = sorted[Math.floor((sorted.length - 1) / 2)]; + console.log( + `Attempts: ${sorted.length} | worst ${formatNumberPair(sorted[0])}` + + ` | median ${formatNumberPair(median)}` + + ` | best ${formatNumberPair(sorted[sorted.length - 1])}`, + ); + } if (!report.top.length) { console.log("\nNo attempts completed.\n"); diff --git a/packages/solver/bin/solve.ts b/packages/solver/bin/solve.ts index 8d3fb7d..33577cf 100644 --- a/packages/solver/bin/solve.ts +++ b/packages/solver/bin/solve.ts @@ -32,8 +32,18 @@ import os from "node:os"; import path from "node:path"; import { ANOMALIES, DEFAULT_ANOMALY_ID } from "../src/data/anomalies"; -import { BUILDINGS, allUpgradesUnlocked } from "../src/data/buildings"; +import { + BUILDINGS, + allUpgradesUnlocked, + findBuilding, +} from "../src/data/buildings"; import { getEffectiveBuildings } from "../src/data/effectiveBuildings"; +import { + MAX_UPGRADE_STEPS, + resolveUpgradePlan, + type UpgradeStep, +} from "../src/data/upgradePlan"; +import { prestigeScales } from "../src/data/prestige"; import { blueprintKey, blueprintRules, @@ -138,6 +148,18 @@ function offsetSeed( return (seed + index * SEED_STRIDE) >>> 0; } +/** + * What the player holds beyond the unlocked tiers: Time Lab research and an + * upgrade plan. Carried as one value so each solve path takes one more + * argument rather than two. + */ +interface Progress { + /** Research levels, keyed and indexed like the player's own record. */ + research: Record; + /** The plan's rosters before its target, today's first — `resolveUpgradePlan`'s `along`. */ + upgradePlan: Record[]; +} + // --- Solving ------------------------------------------------------------- /** @@ -156,6 +178,7 @@ async function solveWithPool( timeBudgetS: number, seed: number | undefined, anomalyId: AnomalyId | undefined, + progress: Progress, pool: WorkerPool | null, ): Promise { const plan = planSolve( @@ -165,6 +188,8 @@ async function solveWithPool( timeBudgetS, seed, anomalyId, + prestigeScales(progress.research), + progress.upgradePlan, ); if (!plan || plan.islands.length < 2 || !pool || pool.size < 2) return solve( @@ -172,7 +197,11 @@ async function solveWithPool( [...BUILDINGS], unlockedUpgrades, timeBudgetS, - { anomalyId }, + { + anomalyId, + prestige: prestigeScales(progress.research), + upgradePlan: progress.upgradePlan, + }, seed, ); @@ -198,6 +227,7 @@ async function solveWithPool( // resolved it, and a worker re-resolving would be a second reading of // the same string. anomaly: plan.anomaly, + upgradeSteps: plan.upgradeSteps, }, })), (i, result) => { @@ -217,10 +247,10 @@ async function solveWithPool( * would come back at roughly its baseline figure with nothing on screen saying * why. * - * The research table is **empty rather than absent**, which is a truthful - * statement and not the same claim: the CLI solves at full building unlocks and - * no Time Lab (there is no flag for one), so "the author had no research" is - * exactly what it knows. `DEFAULT_ANOMALY_ID` spells the absence of `--anomaly` + * The research table is the one the run solved under — a `--code` board's own, + * otherwise **empty rather than absent**, which is a truthful statement and not + * the same claim: "the author had no research" is exactly what the CLI knows + * about a shipped map. `DEFAULT_ANOMALY_ID` spells the absence of `--anomaly` * for the same reason — "no anomaly" is a real choice, and stating it is what * keeps a reader off their own. */ @@ -228,12 +258,13 @@ async function codeFor( grid: Tile[][], result: OptimizationResult, anomalyId: AnomalyId | undefined, + research: Record, ): Promise { return encodeBlueprint( grid, result.placements, placementTiers(result.placements), - blueprintRules(anomalyId ?? DEFAULT_ANOMALY_ID, {}), + blueprintRules(anomalyId ?? DEFAULT_ANOMALY_ID, research), ); } @@ -264,10 +295,15 @@ async function solveMap( filenameFor: (run: SolveRun, bestPower: number) => string, seed: number | undefined, anomalyId: AnomalyId | undefined, + progress: Progress, pool: WorkerPool | null, ): Promise { const { grid } = await decodeBlueprint(gameMap.code); - const roster = getEffectiveBuildings(BUILDINGS, unlockedUpgrades); + const roster = getEffectiveBuildings( + BUILDINGS, + unlockedUpgrades, + prestigeScales(progress.research), + ); const results: SolveRun[] = []; for (let runNum = 1; runNum <= runs; runNum++) { @@ -279,13 +315,14 @@ async function solveMap( timeLimitS, offsetSeed(seed, runNum - 1), anomalyId, + progress, pool, ); results.push({ runNum, result, elapsedS: (Date.now() - started) / 1000, - code: await codeFor(grid, result, anomalyId), + code: await codeFor(grid, result, anomalyId, progress.research), }); } @@ -307,6 +344,7 @@ async function runSingle( timeLimitS: number, seed: number | undefined, anomalyId: AnomalyId | undefined, + progress: Progress, pool: WorkerPool | null, ): Promise { const testId = nextOutputId(TEST_FILENAME_RE); @@ -320,6 +358,7 @@ async function runSingle( () => filename, seed, anomalyId, + progress, pool, ); @@ -338,6 +377,7 @@ async function runComparison( timeLimitS: number, seed: number | undefined, anomalyId: AnomalyId | undefined, + progress: Progress, pool: WorkerPool | null, ): Promise { const sessionId = nextOutputId(ISLAND_FILENAME_RE); @@ -361,6 +401,7 @@ async function runComparison( filenameFor, seed, anomalyId, + progress, pool, ); @@ -382,10 +423,15 @@ function workerCount(attempts: number, requested?: number): number { async function runSession( gameMap: CliMap, unlockedUpgrades: Record, + progress: Progress, args: Args, ): Promise { const { grid } = await decodeBlueprint(gameMap.code); - const roster = getEffectiveBuildings(BUILDINGS, unlockedUpgrades); + const roster = getEffectiveBuildings( + BUILDINGS, + unlockedUpgrades, + prestigeScales(progress.research), + ); const attempts = args.attempts!; const inFlight = workerCount(attempts, args.workers); const board = new Leaderboard(args.top); @@ -429,6 +475,8 @@ async function runSession( timeLimitS: args.timeLimitS, seed: offsetSeed(args.seed, i), anomalyId: args.anomalyId, + prestige: prestigeScales(progress.research), + upgradePlan: progress.upgradePlan, }, })), (attempt, raw) => { @@ -447,7 +495,7 @@ async function runSession( power: result.totalPower, attempt, activeTiles: result.activeTilesCount, - code: await codeFor(grid, result, args.anomalyId), + code: await codeFor(grid, result, args.anomalyId, progress.research), key: blueprintKey(grid, result.placements), }; board.offer(candidate); @@ -472,10 +520,11 @@ async function runSession( async function runSessions( gameMaps: CliMap[], unlockedUpgrades: Record, + progress: Progress, args: Args, ): Promise { for (const gameMap of gameMaps) { - const report = await runSession(gameMap, unlockedUpgrades, args); + const report = await runSession(gameMap, unlockedUpgrades, progress, args); printSessionReport(report); // Ctrl-C stops the session it was pressed in; it does not mean "move on to // the next map", which on `--all` would be another half hour away. @@ -496,11 +545,18 @@ interface Args { workers: number | undefined; seed: number | undefined; anomalyId: AnomalyId | undefined; + /** Tiers held below the last, 0-based like `unlockedUpgrades`. */ + tiers: Record; + /** The upgrade plan, in buying order. */ + plan: UpgradeStep[]; + /** A pasted board to solve instead of a shipped map. */ + code: string | undefined; } const USAGE = `usage: solve [-h] [--map NUM] [--all] [--runs RUNS] [--time TIME_LIMIT_S] [--attempts N] [--top K] [--workers N] [--seed SEED] - [--anomaly ID] + [--anomaly ID] [--tier ID=LEVEL] [--plan ID=LEVEL] + [--code BLUEPRINT] Decode a map, solve it, and report on the result. @@ -522,6 +578,20 @@ options: One of: ${ANOMALIES.map((a) => a.id).join(", ")}. Only the rules the solver implements take effect; the rest are accepted and ignored, exactly as in the app. + --tier ID=LEVEL + hold a building below its last tier (repeatable). LEVEL counts + from 1, like the app's tier buttons; every building not named + is fully upgraded + --plan ID=LEVEL + one step of an upgrade plan (repeatable, in buying order, at + most ${MAX_UPGRADE_STEPS}): the run scores at the tiers after the last + step and keeps only layouts that also run at --tier's tiers + and after each step, exactly as the app's upgrade plan does + --code BLUEPRINT + solve a pasted board instead of a shipped map. Its rules + section, when it has one, supplies the anomaly (unless + --anomaly is given) and the Time Lab research; placements + on it are ignored This renders no picture. Each run writes its blueprint code to solves/, named after what it found and after the anomaly it found it under; paste one into the @@ -539,6 +609,9 @@ function parseArgs(argv: string[]): Args | null { workers: undefined, seed: undefined, anomalyId: undefined, + tiers: {}, + plan: [], + code: undefined, }; const takeValue = ( @@ -567,6 +640,20 @@ function parseArgs(argv: string[]): Args | null { return n; }; + // `ID=LEVEL`, with LEVEL 1-based as typed and 0-based as carried. + const asUpgradeStep = (flag: string, raw: string): UpgradeStep => { + const [buildingId, levelRaw] = raw.split("="); + const def = findBuilding(buildingId); + if (!def || levelRaw === undefined) + throw new Error(`argument ${flag}: expected ID=LEVEL, got '${raw}'`); + const level = asInt(flag, levelRaw); + if (level < 1 || level > def.levels.length) + throw new Error( + `argument ${flag}: ${buildingId} has levels 1-${def.levels.length}, got ${level}`, + ); + return { buildingId, level: level - 1 }; + }; + for (let i = 0; i < argv.length; i++) { const token = argv[i]; const eq = token.indexOf("="); @@ -627,6 +714,18 @@ function parseArgs(argv: string[]): Args | null { args.anomalyId = match.id; } break; + case "--code": + [raw, i] = takeValue(flag, inline, i); + args.code = raw; + break; + case "--tier": + case "--plan": { + [raw, i] = takeValue(flag, inline, i); + const step = asUpgradeStep(flag, raw); + if (flag === "--tier") args.tiers[step.buildingId] = step.level; + else args.plan.push(step); + break; + } default: throw new Error(`unrecognized arguments: ${token}`); } @@ -646,7 +745,21 @@ export async function main(argv: string[]): Promise { if (!args) return 0; let selected: CliMap[]; - if (args.all) { + let research: Record = {}; + if (args.code !== undefined) { + let rules; + try { + ({ rules } = await decodeBlueprint(args.code)); + } catch (err) { + console.error(`--code: ${(err as Error).message}`); + return 1; + } + selected = [{ num: -1, name: "pasted board", code: args.code }]; + if (rules) { + research = rules.research; + args.anomalyId ??= ANOMALIES.find((a) => a.id === rules.anomalyId)?.id; + } + } else if (args.all) { selected = MAPS; } else if (args.maps.length) { const unknown = args.maps.filter((n) => !MAPS_BY_NUM.has(n)); @@ -661,7 +774,30 @@ export async function main(argv: string[]): Promise { selected = [MAPS_BY_NUM.get(DEFAULT_MAP_NUM)!]; } - const unlockedUpgrades = allUpgradesUnlocked(); + if (args.plan.length > MAX_UPGRADE_STEPS) { + console.error(`--plan takes at most ${MAX_UPGRADE_STEPS} steps`); + return 1; + } + const { target: unlockedUpgrades, along: upgradePlan } = resolveUpgradePlan( + BUILDINGS, + { ...allUpgradesUnlocked(), ...args.tiers }, + args.plan, + ); + if (args.plan.length && upgradePlan.length === 0) { + console.error("--plan raises nothing: no step is above its --tier"); + return 1; + } + const progress: Progress = { research, upgradePlan }; + if (Object.keys(research).length) + console.log( + `Research: ${Object.entries(research) + .map(([id, level]) => `${id} ${level + 1}`) + .join(", ")}`, + ); + if (upgradePlan.length) + console.log( + `Upgrade plan: ${args.plan.map((s) => `${s.buildingId} -> ${s.level + 1}`).join(", ")}\n`, + ); if (args.attempts !== undefined) { if (args.attempts < 1) { @@ -672,7 +808,7 @@ export async function main(argv: string[]): Promise { console.error("--workers must be at least 1"); return 1; } - return runSessions(selected, unlockedUpgrades, args); + return runSessions(selected, unlockedUpgrades, progress, args); } const pool = new WorkerPool(WORKER_URL, os.cpus().length); @@ -685,6 +821,7 @@ export async function main(argv: string[]): Promise { args.timeLimitS, args.seed, args.anomalyId, + progress, pool, ); else @@ -694,6 +831,7 @@ export async function main(argv: string[]): Promise { args.timeLimitS, args.seed, args.anomalyId, + progress, pool, ); } finally { diff --git a/packages/solver/bin/worker.ts b/packages/solver/bin/worker.ts index d3cf692..dbb87dd 100644 --- a/packages/solver/bin/worker.ts +++ b/packages/solver/bin/worker.ts @@ -17,6 +17,7 @@ import type { AnomalyId, EffectiveBuilding, IslandSubGrid, + PrestigeScales, Tile, } from "../src/solver/types"; @@ -28,6 +29,7 @@ type Task = budgetS: number; seed?: number; anomaly?: AnomalyDefinition; + upgradeSteps?: EffectiveBuilding[][]; } | { kind: "attempt"; @@ -36,6 +38,8 @@ type Task = timeLimitS: number; seed?: number; anomalyId?: AnomalyId; + prestige?: PrestigeScales; + upgradePlan?: Record[]; }; parentPort?.on( @@ -51,13 +55,18 @@ parentPort?.on( undefined, payload.seed, payload.anomaly, + payload.upgradeSteps, ) : await solve( payload.grid, [...BUILDINGS], payload.unlockedUpgrades, payload.timeLimitS, - { anomalyId: payload.anomalyId }, + { + anomalyId: payload.anomalyId, + prestige: payload.prestige, + upgradePlan: payload.upgradePlan, + }, payload.seed, ); parentPort?.postMessage({ meta, result }); diff --git a/packages/solver/fixtures/three_island_uneven.json b/packages/solver/fixtures/three_island_uneven.json index 8083490..5bf834b 100755 --- a/packages/solver/fixtures/three_island_uneven.json +++ b/packages/solver/fixtures/three_island_uneven.json @@ -94,11 +94,6 @@ "y": 0, "building_id": "cooler8" }, - { - "x": 12, - "y": 0, - "building_id": "wind_turbine" - }, { "x": 0, "y": 1, diff --git a/packages/solver/src/data/buildingPrices.ts b/packages/solver/src/data/buildingPrices.ts new file mode 100644 index 0000000..b0e290b --- /dev/null +++ b/packages/solver/src/data/buildingPrices.ts @@ -0,0 +1,87 @@ +import { TIME_LAB } from "./timeLab"; + +/** + * What a building costs to put down and pays back to take up, in the game. + * + * Every copy of a building costs more than the last: `base × scaler^copies`, + * the copies counted across all the player's islands, and the scaler 1.14 + * until Standardized Builds lowers it. Two researches then take a share off — + * Construction Permits (city research) and Quantum Replicator (Time Lab) — + * and they multiply. Selling refunds a share of the **current** price, what the + * next copy would cost, by Salvage Protocols, and drops the count by one. + * Moving a building is free. + * + * Transcribed by hand from the extractor's progression record + * (`tools/data/progression.json`), the way `TIME_LAB` is; the base prices are + * the catalogue's own `price`. The rules are the game developer's, confirmed by + * the player: copies global, refund of the current price, moves free. + */ + +/** Standardized Builds: the per-copy scaler at each level, 0 the default. */ +const COST_SCALER = [ + 1.14, 1.13, 1.12, 1.11, 1.09, 1.07, 1.05, 1.03, 1.025, 1.02, +]; + +/** Construction Permits: the share taken off, by level. */ +const PERMITS = [0, 0.1, 0.19, 0.27, 0.34, 0.4, 0.45, 0.49, 0.52, 0.54, 0.55]; + +/** + * Salvage Protocols: the share of the current price a sale refunds, by level. + * Level 0 is **assumed**: the record starts at level 1's 55% and climbs by + * five points, so a player who has bought none is taken to get 50%. + */ +const REFUND = [0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.94, 0.98]; + +/** The game's research ids, as a game export's research section spells them. */ +const RESEARCH = { + scaler: "BuildingsCostMultiplierResearchSO", + permits: "BuildingPriceReductionResearchSO", + refund: "BuildingSellRefundResearchSO", + replicator: "quantum_replicator", +} as const; + +export interface PriceRules { + /** What each copy multiplies the price by. */ + scaler: number; + /** What is left of a price after both reductions: 1 with neither. */ + discount: number; + /** The share of the current price a sale refunds. */ + refund: number; +} + +const at = (table: readonly number[], level: number) => + table[Math.max(0, Math.min(level, table.length - 1))]; + +/** The price rules a player's research gives, from a game export's levels. */ +export function priceRules( + research: Readonly>, +): PriceRules { + const replicator = TIME_LAB.find((r) => r.id === RESEARCH.replicator)!; + const replicatorLevel = research[RESEARCH.replicator] ?? 0; + const replicatorCut = + replicatorLevel > 0 ? at(replicator.values!, replicatorLevel - 1) : 0; + return { + scaler: at(COST_SCALER, research[RESEARCH.scaler] ?? 0), + discount: + (1 - at(PERMITS, research[RESEARCH.permits] ?? 0)) * (1 - replicatorCut), + refund: at(REFUND, research[RESEARCH.refund] ?? 0), + }; +} + +/** What the next copy costs with `copies` already standing. */ +export function buildPrice( + base: number, + copies: number, + rules: PriceRules, +): number { + return base * rules.scaler ** Math.max(0, copies) * rules.discount; +} + +/** What selling one pays back with `copies` standing, the one sold included. */ +export function sellRefund( + base: number, + copies: number, + rules: PriceRules, +): number { + return copies > 0 ? buildPrice(base, copies, rules) * rules.refund : 0; +} diff --git a/packages/solver/src/data/chronons.ts b/packages/solver/src/data/chronons.ts new file mode 100644 index 0000000..96170f7 --- /dev/null +++ b/packages/solver/src/data/chronons.ts @@ -0,0 +1,200 @@ +import type { GameExportTimeline } from "../encoding/gameExport"; + +/** + * What a Time Jump pays, and when the next Chronon lands. + * + * The award is the game's `ChrononFormula`, read out of its binary and then + * stated by its developer in the same form: + * + * Chronons = max(1, floor(97.34 × (E / 2.82e16)^0.135 × M)) + B + * + * `E` is the timeline's energy, online and offline; `M` the Chronon Reactor + * multiplier; `B` the first-entry bonus — 88 the first time a timeline runs + * under a given anomaly, otherwise 0, and added after the multiplier rather + * than through it. At `E = 0` the game pays 0, not the `max(1, …)` floor. + * + * Every sample the game exported carries its own award, and this formula + * reproduces each one (`tests/chronons.test.ts`). The projection was then held + * against a live save: from the export's figures and the board's power taken + * per 3-second tick, it put the next Chronon within two seconds of the game's. + * + * The exponent is the fact that matters to a player: doubling a whole + * timeline's energy buys about 9.8% more Chronons. The multiplier and the + * first-entry bonus are the levers that move the count; layout power mostly + * moves how soon it arrives. + */ + +const AWARD_BASE = 97.34; +const ENERGY_SCALE = 2.82e16; +const EXPONENT = 0.135; + +/** `B`: paid on a timeline's first entry into an anomaly, unmultiplied. */ +export const FIRST_ENTRY_BONUS = 88; + +/** + * Seconds per game tick. A board's power — what `simulateIsland` totals, and + * what the readout prints — is energy per tick, so this turns it into the rate + * timeline energy grows at. + */ +export const TICK_SECONDS = 3; + +/** + * Chronon Reactor's authored `BonusPercentage` per level, from the external + * extractor's Time Lab record. It is one of the nine researches + * `PRESTIGE_UPGRADES` leaves out, since it changes no layout; it is carried + * here because it is the `M` above. + */ +const CHRONON_REACTOR_BONUSES = [0.05, 0.1, 0.15, 0.2, 0.25] as const; + +/** The game's research id for it, as a game export spells it. */ +export const CHRONON_REACTOR_ID = "chronon_reactor"; + +/** `M` at a purchased level — 0 means not bought, and is ×1. */ +export function chrononMultiplier(level: number): number { + if (!(level > 0)) return 1; + const i = Math.min(level, CHRONON_REACTOR_BONUSES.length) - 1; + return 1 + CHRONON_REACTOR_BONUSES[i]; +} + +/** Chronons a jump pays for `energy`, without the first-entry bonus. */ +export function chrononAward(energy: number, multiplier: number): number { + if (!(energy > 0)) return 0; + return Math.max( + 1, + Math.floor(AWARD_BASE * (energy / ENERGY_SCALE) ** EXPONENT * multiplier), + ); +} + +/** + * The timeline energy at which the award first reaches `award` — the inverse + * of `chrononAward`, up to its floor. + */ +export function energyForAward(award: number, multiplier: number): number { + if (award <= 1) return 0; + return ENERGY_SCALE * (award / (AWARD_BASE * multiplier)) ** (1 / EXPONENT); +} + +/** + * Seconds until a timeline at `energy`, growing at `energyPerSecond`, pays + * `target` on a jump (first-entry bonus excluded): 0 when it already does, + * null when it never will because nothing is being produced. + * + * Real seconds. The game counts offline time in real time, but its ticks run + * a little slow while it is open, so a target hours away arrives somewhat + * later than this for a player who keeps the game open throughout. + */ +export function secondsUntilAward( + energy: number, + energyPerSecond: number, + multiplier: number, + target: number, +): number | null { + if (chrononAward(energy, multiplier) >= target) return 0; + if (!(energyPerSecond > 0)) return null; + return (energyForAward(target, multiplier) - energy) / energyPerSecond; +} + +const THRESHOLD_BASE = 88; +const THRESHOLD_GROWTH = 1.15; +const THRESHOLD_CAP = 5000; + +/** + * The smallest award (bonus excluded) the game lets a player jump on, after + * `generation` completed jumps: 88, 101, 116, 134, 154 … capped at 5000 from + * the 29th. Rounded half away from zero, which on a positive number is what + * `Math.round` does. + */ +export function jumpThreshold(generation: number): number { + return Math.min( + THRESHOLD_CAP, + Math.round(THRESHOLD_BASE * THRESHOLD_GROWTH ** Math.max(0, generation)), + ); +} + +/** + * The anomaly a first-entry bonus is filed under. A rebalance is still the + * same anomaly — the game writes `tidal_ascendancy` into the entered list + * whichever balance the save runs — so a balance-variant id folds back. + */ +function bonusAnomaly(anomalyId: string): string { + return anomalyId === "tidal_ascendancy_legacy" + ? "tidal_ascendancy" + : anomalyId; +} + +/** `B` for a jump into `anomalyId`, given the anomalies already entered. */ +export function firstEntryBonus( + anomalyId: string, + entered: readonly string[], +): number { + if (anomalyId === "none") return 0; + return entered.includes(bonusAnomaly(anomalyId)) ? 0 : FIRST_ENTRY_BONUS; +} + +/** Where a timeline stands at one moment, projected from an export. */ +export interface TimelineProjection { + /** Seconds since the export the projection ran forward. */ + sinceExport: number; + energy: number; + elapsedSeconds: number; + /** Chronons a jump pays now, first-entry bonus excluded. */ + award: number; + /** Seconds until the award goes up by one; null when energy is not growing. */ + secondsToNext: number | null; + /** + * How long the Chronon now under way takes from start to finish, at this + * rate; null when energy is not growing. Each one takes a little longer + * than the last. + */ + chrononSeconds: number | null; + /** + * How far the energy is from this award's threshold to the next one's, 0 to + * 1 — the game's own "until next Chronon" bar. + */ + towardNext: number; + /** The award a jump needs, and whether this one clears it. */ + threshold: number; + canJump: boolean; +} + +/** + * Runs an exported timeline forward to `atUnixSeconds` at `energyPerSecond`. + * + * A code is a photograph: it may be pasted minutes or days after the game + * wrote it, and the timeline kept running in between — offline time counts + * too. So nothing is shown as the export's own figure; everything is carried + * forward from `exportedAt`. A clock behind the export's (a device clock, or a + * server time ahead of it) projects nothing rather than running backwards. + * + * The rate is the caller's to choose, and the right one is the power the + * player's game boards make — not a board edited here since, which the game + * has not seen. + */ +export function projectTimeline( + timeline: Pick< + GameExportTimeline, + "exportedAt" | "energy" | "elapsedSeconds" | "generation" + >, + energyPerSecond: number, + multiplier: number, + atUnixSeconds: number, +): TimelineProjection { + const sinceExport = Math.max(0, atUnixSeconds - timeline.exportedAt); + const rate = energyPerSecond > 0 ? energyPerSecond : 0; + const energy = timeline.energy + rate * sinceExport; + const award = chrononAward(energy, multiplier); + const next = Math.max(energyForAward(award + 1, multiplier), energy); + const from = Math.min(energyForAward(award, multiplier), energy); + const threshold = jumpThreshold(timeline.generation); + return { + sinceExport, + energy, + elapsedSeconds: timeline.elapsedSeconds + sinceExport, + award, + secondsToNext: rate > 0 ? (next - energy) / rate : null, + chrononSeconds: rate > 0 ? (next - from) / rate : null, + towardNext: next > from ? (energy - from) / (next - from) : 0, + threshold, + canJump: award >= threshold, + }; +} diff --git a/packages/solver/src/data/prestige.ts b/packages/solver/src/data/prestige.ts index 51b1b87..3ffc779 100644 --- a/packages/solver/src/data/prestige.ts +++ b/packages/solver/src/data/prestige.ts @@ -14,7 +14,7 @@ import type { * carries a `multiplier` array that is just `1 + values`, and it is not copied, * because deriving it is what keeps the two from drifting. * - * **Three of the game's eleven are here.** The other eight change the economy + * **Three of the game's twelve are here.** The other nine change the economy * around the board rather than anything on it, and the solver cannot feel any * of them — they are listed so it is clear they were read and dismissed rather * than missed: @@ -25,6 +25,7 @@ import type { * - `erased_from_time` / `phase_breaker` — obstacle removal time and cost * - `quantum_exchange` — energy sale price * - `quantum_replicator` — building prices + * - `skip_city` (Chrono Seed) — the City level the next timeline starts at * - `zero_time_protocol` — free research speed-up window * * The solver optimises power on a fixed board from a fixed roster. What a diff --git a/packages/solver/src/data/timeLab.ts b/packages/solver/src/data/timeLab.ts new file mode 100644 index 0000000..755c729 --- /dev/null +++ b/packages/solver/src/data/timeLab.ts @@ -0,0 +1,235 @@ +import { chrononAward, chrononMultiplier } from "./chronons"; + +/** + * Every Time Lab research: what each level costs in Chronons and what it does. + * + * Transcribed by hand from the external extractor's Time Lab record, the way + * `PRESTIGE_UPGRADES` and `ANOMALIES` are — nothing splices this file. That + * table carries only the three researches a layout can feel and exists to + * rate buildings; this one carries all twelve and exists to *buy* them, so the + * Time Lab planner can price a jump's worth of Chronons. Where the two overlap + * they must agree, and `tests/timeLab.test.ts` holds them to it. + * + * `values` is the authored figure each level reaches, in the unit `kind` + * names. Chrono Seed has none: its record authors eighteen "levels" against + * six costs, and the values read as city levels rather than a bonus — six + * purchases are what the game sells, and what it delivers is said in words. + */ + +/** How a research's `values` read. */ +export type TimeLabKind = + /** A fraction added on top: 0.5 reads "+50%". */ + | "bonus" + /** A fraction taken off: 0.2 reads "−20%". */ + | "reduction" + /** A window in seconds: 900 reads "15m". */ + | "window" + /** No figure — what a level gives is in the description. */ + | "level"; + +export interface TimeLabResearch { + /** The extractor's id, which is also the game's — bar Chrono Seed's. */ + id: string; + /** The id a game export's research section files it under. */ + gameId: string; + name: string; + /** What it changes, short: the row's subtitle. */ + effect: string; + description: string; + kind: TimeLabKind; + /** The figure each level reaches, level 1 first; null for `level`. */ + values: readonly number[] | null; + /** Chronons each level costs, level 1 first. Its length is the cap. */ + costs: readonly number[]; +} + +export const TIME_LAB: readonly TimeLabResearch[] = [ + { + id: "chronon_reactor", + gameId: "chronon_reactor", + name: "Chronon Reactor", + effect: "Chronons per jump", + description: + "Extracts more Chronons from the Energy produced in each timeline.", + kind: "bonus", + values: [0.05, 0.1, 0.15, 0.2, 0.25], + costs: [150, 350, 800, 1800, 4000], + }, + { + id: "stellar_forge", + gameId: "stellar_forge", + name: "Stellar Forge", + effect: "Reactor heat", + description: "Boosts the Heat output of all Heat Producers.", + kind: "bonus", + values: [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5], + costs: [15, 25, 45, 85, 150, 260, 460, 820, 1500, 2600], + }, + { + id: "infinite_grid", + gameId: "infinite_grid", + name: "Infinite Grid", + effect: "Generators and wind turbines", + description: + "Improves all Generators and Wind Turbines, increasing Energy output, " + + "Heat, and overheat thresholds.", + kind: "bonus", + values: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], + costs: [10, 20, 35, 70, 130, 250, 480, 910, 1700, 3300], + }, + { + id: "absolute_zero", + gameId: "absolute_zero", + name: "Absolute Zero", + effect: "Cooling output", + description: "Boosts the Cooling output of all cooling systems.", + kind: "bonus", + values: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], + costs: [10, 20, 35, 70, 130, 250, 480, 910, 1700, 3300], + }, + { + id: "archives_beyond_time", + gameId: "archives_beyond_time", + name: "Archives Beyond Time", + effect: "Research point income", + description: + "Recovers knowledge from lost timelines, increasing Research Point " + + "income.", + kind: "bonus", + values: [0.5, 1.2, 1.9, 2.6, 3.4, 4.3, 5.3, 6.5, 8.0, 10.0, 13.0], + costs: [15, 30, 60, 120, 240, 480, 970, 1900, 3900, 7800, 16000], + }, + { + id: "chrono_accelerator", + gameId: "chrono_accelerator", + name: "Chrono Accelerator", + effect: "Research time", + description: + "Accelerates all research, reducing the time needed to complete it.", + kind: "reduction", + values: [0.2, 0.3, 0.39, 0.47, 0.54, 0.6, 0.65, 0.72, 0.81, 0.9, 0.94], + costs: [20, 45, 100, 220, 500, 1100, 2500, 5500, 12000, 28000, 62000], + }, + { + id: "zero_time_protocol", + gameId: "zero_time_protocol", + name: "Zero-Time Protocol", + effect: "Free research speed-up", + description: + "Extends the time window for free research completion, adding to your " + + "existing free speedup.", + kind: "window", + values: [ + 1200, 1800, 2700, 3600, 4800, 6000, 7500, 9300, 11400, 14100, 17400, + ], + costs: [20, 35, 60, 100, 170, 280, 480, 820, 1400, 2400, 4100], + }, + { + id: "quantum_exchange", + gameId: "quantum_exchange", + name: "Quantum Exchange", + effect: "Energy sale price", + description: "Increases the price of all energy sold, including surplus.", + kind: "bonus", + values: [1.0, 1.7, 2.4, 3.2, 4.0, 4.9, 5.8, 6.8, 8.0, 9.4, 11.0], + costs: [20, 40, 80, 170, 330, 680, 1400, 2800, 5600, 11000, 23000], + }, + { + id: "quantum_replicator", + gameId: "quantum_replicator", + name: "Quantum Replicator", + effect: "Building cost", + description: + "Replicates construction materials, reducing the cost of all buildings.", + kind: "reduction", + values: [0.15, 0.27, 0.37, 0.45, 0.52, 0.58, 0.62, 0.66, 0.69, 0.72, 0.75], + costs: [10, 20, 40, 80, 160, 320, 640, 1300, 2600, 5100, 10000], + }, + { + id: "phase_breaker", + gameId: "phase_breaker", + name: "Phase Breaker", + effect: "Obstacle removal time", + description: + "Destabilizes obstacles, reducing the time needed to remove them.", + kind: "reduction", + values: [0.25, 0.35, 0.45, 0.55, 0.62, 0.68, 0.74, 0.8, 0.85, 0.9], + costs: [5, 10, 30, 70, 160, 380, 910, 2200, 5200, 12000], + }, + { + id: "erased_from_time", + gameId: "erased_from_time", + name: "Erased from Time", + effect: "Free obstacle finish", + description: + "Allows you to finish removing an obstacle for free when its remaining " + + "removal time is within the limit.", + kind: "window", + values: [ + 900, 1500, 2100, 3000, 4200, 5400, 7200, 9600, 12600, 16800, 21600, + ], + costs: [5, 10, 25, 55, 120, 260, 560, 1200, 2700, 6000, 13000], + }, + { + id: "skip_city", + gameId: "TimeLabSkipCityResearchSO", + name: "Chrono Seed", + effect: "City after jump", + description: + "After your next Time Jump, start at a higher City level with a starter " + + "kit to assemble and replay rewards for skipped chapters.", + kind: "level", + values: null, + costs: [150, 500, 1500, 3000, 6000, 12000], + }, +]; + +/** One research by id; throws on an id the table does not have. */ +export function timeLabResearch(id: string): TimeLabResearch { + const r = TIME_LAB.find((t) => t.id === id); + if (!r) throw new Error(`No Time Lab research "${id}"`); + return r; +} + +/** + * Each research's purchased level, by our id, read off a game export's + * research section — 0 for one it does not name, and clamped to the levels + * this table carries, so a game that adds a level does not read past it. + */ +export function timeLabLevels( + research: Readonly>, +): Record { + const out: Record = {}; + for (const r of TIME_LAB) { + const level = research[r.gameId] ?? 0; + out[r.id] = Math.max(0, Math.min(level, r.costs.length)); + } + return out; +} + +/** What levels `from + 1` through `to` cost together; 0 when `to <= from`. */ +export function timeLabCost( + research: TimeLabResearch, + from: number, + to: number, +): number { + let sum = 0; + for (let l = Math.max(from, 0); l < Math.min(to, research.costs.length); l++) + sum += research.costs[l]; + return sum; +} + +/** + * Chronons a jump pays at `energy` with Chronon Reactor at `to` rather than + * `from` — the one research whose worth is a count of Chronons. + */ +export function chrononReactorGain( + energy: number, + from: number, + to: number, +): number { + return ( + chrononAward(energy, chrononMultiplier(to)) - + chrononAward(energy, chrononMultiplier(from)) + ); +} diff --git a/packages/solver/src/encoding/gameExport.ts b/packages/solver/src/encoding/gameExport.ts index a2d8c16..d901047 100644 --- a/packages/solver/src/encoding/gameExport.ts +++ b/packages/solver/src/encoding/gameExport.ts @@ -29,11 +29,23 @@ import { base64UrlToUint8Array, pipeThrough } from "./streams"; * 4. research uint16 n · n × (string id · uint16 level) * 5. ongoing uint16 n · n × (string id · uint16 target level · int32 secs) * 6. clearing uint16 n · n × (int16 x · int16 y · int32 secs) + * 7. timeline int64 exported at (Unix s, UTC) · int64 chronons · double + * timeline energy · int64 timeline secs · int64 award now · + * uint16 n · n × string anomaly entered · int32 generation + * [· double cash · double research points + * [· byte stamp source: 0 server, 1 device clock]] * * Integers are little-endian; a string is a 7-bit-encoded length followed by * UTF-8. A section appended after these is ignored rather than refused, so the * game can grow the format without a version bump; anything else is a new * version, and an unknown version is refused rather than guessed at. + * + * Section 7 arrived that way, in game 1.1.11, so a code written before it ends + * after section 6 and reads with `timeline: null`. It is all-or-nothing up to + * the generation: a code that starts it must finish it, since a half-read + * timeline would hand the Chronon figures a stray number. Cash and research + * points were appended after the first samples, by the same rule, so a code + * ending at the generation reads them as null. */ /** The only format version this build reads. */ @@ -71,6 +83,56 @@ export interface GameExportClearing { secondsLeft: number; } +/** + * Where the player's timeline stands at the moment of export — the figures a + * Time Jump is paid from. See `docs/game-export.md` section 4.5. + */ +export interface GameExportTimeline { + /** + * Unix seconds, UTC: the game's server time when it has synced, the device + * clock otherwise. What a code pasted later is brought forward from. + */ + exportedAt: number; + /** Chronons held, unspent. */ + chronons: number; + /** + * `TimelineEnergyProduced`, online and offline — the `E` the award is + * computed from. A save older than the Time Jump counts from its first + * launch after that update, and so does `elapsedSeconds`. + */ + energy: number; + /** Seconds since the timeline began, on the game's own clock. */ + elapsedSeconds: number; + /** + * The game's own award for jumping now, **without** the first-entry bonus: + * that one depends on which anomaly the jump picks. + */ + jumpAward: number; + /** + * Anomalies whose first-entry bonus is spent. Tidal Ascendancy is always + * `tidal_ascendancy` here, whatever balance the header names — the bonus + * belongs to the anomaly, not to its balance. + */ + anomaliesEntered: string[]; + /** Time Jumps completed: 0 before the first. */ + generation: number; + /** + * The raw signed cash balance — **negative** while the player builds on + * credit, down to the limit Build Credit research sets. Null on a code from + * before the field. + */ + cash: number | null; + /** Research points held; null on a code from before the field. */ + researchPoints: number | null; + /** + * Which clock wrote `exportedAt`: the game's server time, or — when the game + * had not synced yet — the device's own, which may be off by however far the + * device is. Null on a code from before the field, or a value this build + * does not know. + */ + stampSource: "server" | "device" | null; +} + export interface GameExport { version: number; gameVersion: string; @@ -84,6 +146,8 @@ export interface GameExport { research: Record; researchInProgress: GameExportProgress[]; clearing: GameExportClearing[]; + /** Section 7, or null on a code the game wrote before it had one. */ + timeline: GameExportTimeline | null; } /** @@ -138,6 +202,29 @@ class Reader { return v; } + /** + * `BinaryWriter.Write(long)`, as a number. Every int64 in the format is a + * count or a time far inside 2^53, so nothing is lost by not being a bigint. + */ + i64(): number { + this.#need(8); + const low = this.#view.getUint32(this.#at, true); + const high = this.#view.getInt32(this.#at + 4, true); + this.#at += 8; + return high * 2 ** 32 + low; + } + + f64(): number { + this.#need(8); + const v = this.#view.getFloat64(this.#at, true); + this.#at += 8; + return v; + } + + get done(): boolean { + return this.#at >= this.#bytes.length; + } + /** `BinaryWriter.Write(string)`: a 7-bit-encoded length, then UTF-8. */ str(): string { let length = 0; @@ -243,6 +330,36 @@ export async function decodeGameExport(text: string): Promise { clearing.push({ x: r.i16(), y: r.i16(), secondsLeft: r.i32() }); } + let timeline: GameExportTimeline | null = null; + if (!r.done) { + const exportedAt = r.i64(); + const chronons = r.i64(); + const energy = r.f64(); + const elapsedSeconds = r.i64(); + const jumpAward = r.i64(); + const anomaliesEntered: string[] = []; + for (let n = r.u16(); n > 0; n--) anomaliesEntered.push(r.str()); + const generation = r.i32(); + const hasBalances = !r.done; + const cash = hasBalances ? r.f64() : null; + const researchPoints = hasBalances ? r.f64() : null; + const source = r.done ? null : r.u8(); + const stampSource = + source === 0 ? "server" : source === 1 ? "device" : null; + timeline = { + exportedAt, + chronons, + energy, + elapsedSeconds, + jumpAward, + anomaliesEntered, + generation, + cash, + researchPoints, + stampSource, + }; + } + return { version, gameVersion, @@ -253,5 +370,6 @@ export async function decodeGameExport(text: string): Promise { research, researchInProgress, clearing, + timeline, }; } diff --git a/packages/solver/src/index.ts b/packages/solver/src/index.ts index 013d414..422eb04 100644 --- a/packages/solver/src/index.ts +++ b/packages/solver/src/index.ts @@ -29,11 +29,14 @@ export * from "./solver/report"; export * from "./solver/solver"; export * from "./data/anomalies"; +export * from "./data/buildingPrices"; export * from "./data/buildings"; +export * from "./data/chronons"; export * from "./data/effectiveBuildings"; export * from "./data/gameImport"; export * from "./data/maps"; export * from "./data/prestige"; +export * from "./data/timeLab"; export * from "./data/upgradePlan"; export * from "./encoding/blueprint"; diff --git a/packages/solver/src/solver/placementSearch.ts b/packages/solver/src/solver/placementSearch.ts index 22395d3..3e57fd2 100755 --- a/packages/solver/src/solver/placementSearch.ts +++ b/packages/solver/src/solver/placementSearch.ts @@ -9,6 +9,7 @@ import type { IslandLayout, IslandSubGrid, PlacedBuilding, + Placement, SearchHooks, } from "./types"; import { hillClimb } from "./search/anneal"; @@ -304,6 +305,13 @@ export async function replayIslandDeterministic( }; } +/** + * How much one reactor tier is worth over the one below it. Every reactor in + * the catalogue steps by this factor, give or take the authored rounding, so + * dividing by it is "one tier down" without a second lookup into the table. + */ +const TIER_STEP = 1.25; + /** * Solves one island. * @@ -313,7 +321,6 @@ export async function replayIslandDeterministic( * narrows run-to-run variance rather than eliminating it. Omitting it draws a * fresh seed, preserving the stochastic default. */ - export async function solveIsland( island: IslandSubGrid, effectiveBuildings: EffectiveBuilding[], @@ -387,12 +394,32 @@ export async function solveIsland( deadlineMs, ); + // A seed built from a roster other than the one being scored, rewritten in + // the scored roster's buildings by id, replaces the seed when it runs better. + const targetById = new Map(effectiveBuildings.map((b) => [b.id, b])); + const adoptIfBetter = (altSeed: Placement) => { + const remapped = emptyPlacement(ctx.n); + for (let t = 0; t < ctx.n; t++) { + const b = altSeed[t]; + const target = b === null ? undefined : targetById.get(b.id); + if (target !== undefined) put(remapped, ctx, t, target); + } + if (stabilize(remapped, ctx).power > stabilize(seed, ctx).power) { + seed = remapped; + } + }; + // Under a plan, a seed built from the target roster is sized for buildings // the player does not have yet: fewer coolers than today's tiers need, so // stabilizing it strips it bare — and nothing downstream puts the cooling // back, since a cooler that only today needs never raises target power. So // seed from the first step (today's tiers) as well, written in target // buildings, and start from whichever runs better across the plan. + // + // Under a terrain bonus without a plan, seed as well from the roster with + // its top reactor one tier down: the shore multiplies a hub's heat, so a + // seed sized for the full reactor is short of cooling there, the same way a + // target-sized seed is under a plan. See `docs/SOLVER.md`. const plan = upgradePlans.get(ctx); if (plan !== undefined) { const today = plan.steps[0]; @@ -401,24 +428,37 @@ export async function solveIsland( .filter((b) => b.type === type) .map(pool) .sort((a, b) => b[key] - a[key]); - const todaySeed = constructMultiStartSeed( - ctx, - byRole("reactor", "effectiveValue"), - byRole("generator", "effectiveValue"), - byRole("cooler", "effectiveValue"), - byRole("direct_producer", "energy"), - deadlineMs, + adoptIfBetter( + constructMultiStartSeed( + ctx, + byRole("reactor", "effectiveValue"), + byRole("generator", "effectiveValue"), + byRole("cooler", "effectiveValue"), + byRole("direct_producer", "energy"), + deadlineMs, + ), + ); + } else if ( + ctx.anomaly.rule === "terrain_affinity" && + !ctx.uniformRating && + reactors.length > 0 + ) { + const top = reactors[0]; + const weaker = reactors + .map((b) => + b === top ? { ...b, effectiveValue: b.effectiveValue / TIER_STEP } : b, + ) + .sort((a, b) => b.effectiveValue - a.effectiveValue); + adoptIfBetter( + constructMultiStartSeed( + ctx, + weaker, + generators, + coolers, + directProducers, + deadlineMs, + ), ); - const targetById = new Map(effectiveBuildings.map((b) => [b.id, b])); - const remapped = emptyPlacement(ctx.n); - for (let t = 0; t < ctx.n; t++) { - const b = todaySeed[t]; - const target = b === null ? undefined : targetById.get(b.id); - if (target !== undefined) put(remapped, ctx, t, target); - } - if (stabilize(remapped, ctx).power > stabilize(seed, ctx).power) { - seed = remapped; - } } // Repair the seed before annealing, and again afterwards. Seed construction diff --git a/packages/solver/src/solver/search/repair.ts b/packages/solver/src/solver/search/repair.ts index 4dbeda3..d16731f 100644 --- a/packages/solver/src/solver/search/repair.ts +++ b/packages/solver/src/solver/search/repair.ts @@ -188,7 +188,8 @@ export async function greedyPolish( * Post-search cleanup: * 1. Drops every producer generating 0 power, repeating until none remain. * 2. Sequentially tests removing reactors/coolers to eliminate redundant - * support structures. + * support structures, and direct producers whose output the island's + * total is too large to register. * 3. Guarantees a stable layout — every returned producer is online — with a * minimal active tile footprint. * @@ -215,12 +216,25 @@ export function pruneDeadWeight( let bestPower = stabilized.power; let rows = stabilized.rows; - // 2. Greedy backward sweep: test removing support buildings (reactors & coolers). + // 2. Greedy backward sweep: test removing support buildings (reactors & + // coolers), and direct producers too. + // + // A direct producer earns its tile on a small island, where a wind turbine + // beside a cooler is the most two tiles can make. On a large one its output + // is below the resolution of the island's total: 7 added to 1.5e25 is + // 1.5e25 exactly, since a double's last place there is around 2e9. Every + // comparison the search makes then reads it as worth nothing, so the walk + // drifts turbines in as neutral moves (a zero delta is always accepted) and + // nothing ever has a reason to take them out. Measured on Shadowspire under + // Singularity: five turbines across its two main islands on one run, none on + // the next. Removing one is accepted on the same guard as any support + // building — total power not lower — so a turbine whose 7 registers stays. const support: number[] = []; for (let tile = 0; tile < ctx.n; tile++) { const b = current[tile]; if (b === null) continue; - if (b.type === "cooler" || isReactor(b)) support.push(tile); + if (b.type === "cooler" || b.type === "direct_producer" || isReactor(b)) + support.push(tile); } for (const tile of support) { diff --git a/packages/solver/src/solver/simulate.ts b/packages/solver/src/solver/simulate.ts index 99dfa4b..2add9a4 100755 --- a/packages/solver/src/solver/simulate.ts +++ b/packages/solver/src/solver/simulate.ts @@ -64,11 +64,19 @@ const conversion = { power: 0.0, waste: 0.0 }; * its reactors and generators are moving around, which is what the inspector * asks for. It changes no number that a short-circuited layout would otherwise * have reported; it only fills in the ones the search would have skipped. + * + * `flows`, when given, is filled with every supplier -> consumer pair that + * actually moved something, as flat `[supplierTile, consumerTile, ...]` island + * tile indices: heat from reactors to generators, then cooling from coolers to + * power sources. It is a read of what the distribution already decided — it + * changes no number — and the search never asks for it, so the hot path pays + * one untaken branch per distribution. */ export function simulateIsland( placement: Placement, ctx: IslandContext, fullReport = false, + flows?: number[], ): SimulationResult { const n = ctx.n; const reactorTiles = ctx.reactorTiles; @@ -189,6 +197,16 @@ export function simulateIsland( numGenerators, ctx, ); + if (flows) { + collectFlows( + ctx, + flows, + reactorTiles, + numReactors, + generatorTiles, + numGenerators, + ); + } for (let i = 0; i < numReactors; i++) heatOut[reactorTiles[i]] = d.supplierSent[i]; for (let j = 0; j < numGenerators; j++) @@ -281,6 +299,17 @@ export function simulateIsland( for (let i = 0; i < numCoolers; i++) heatOut[coolerTiles[i]] = layout[coolerTiles[i]]!.effectiveValue * share; + + // Every cooler doing work pays into every source the pool served. + if (flows) { + for (let i = 0; i < numCoolers; i++) { + if (heatOut[coolerTiles[i]] <= EPS) continue; + for (let j = 0; j < numWaste; j++) { + if (coolingIn[wasteTiles[j]] > EPS) + flows.push(coolerTiles[i], wasteTiles[j]); + } + } + } } else { for (let i = 0; i < numCoolers; i++) { d.supplierCap[i] = layout[coolerTiles[i]]!.effectiveValue; @@ -289,6 +318,9 @@ export function simulateIsland( d.consumerCap[j] = wasteOf[wasteTiles[j]]; } runDistribution(coolerTiles, numCoolers, wasteTiles, numWaste, ctx); + if (flows) { + collectFlows(ctx, flows, coolerTiles, numCoolers, wasteTiles, numWaste); + } for (let i = 0; i < numCoolers; i++) heatOut[coolerTiles[i]] = d.supplierSent[i]; for (let j = 0; j < numWaste; j++) @@ -337,6 +369,28 @@ export function simulateIsland( return { totalPower, placements }; } +/** + * Appends every pair the last `runDistribution` moved something along — see + * `simulateIsland`'s `flows`. Module-level rather than a closure so the search, + * which never passes `flows`, allocates nothing for it. + */ +function collectFlows( + ctx: IslandContext, + flows: number[], + supplierTiles: Int32Array, + numSuppliers: number, + consumerTiles: Int32Array, + numConsumers: number, +): void { + const flow = ctx.dist.flow; + for (let i = 0; i < numSuppliers; i++) { + for (let j = 0; j < numConsumers; j++) { + if (flow[i * numConsumers + j] > EPS) + flows.push(supplierTiles[i], consumerTiles[j]); + } + } +} + /** * Report rows for a layout that produces nothing — every measured field is * zero, leaving each building's two capacity figures (`baseValue` and the diff --git a/packages/solver/tests/buildingPrices.test.ts b/packages/solver/tests/buildingPrices.test.ts new file mode 100644 index 0000000..9f4185e --- /dev/null +++ b/packages/solver/tests/buildingPrices.test.ts @@ -0,0 +1,55 @@ +/** + * The game's building prices: copies compound, the two reductions multiply, + * and a sale refunds a share of the current price. Held against the player's + * own research levels as a game export reports them. + */ +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { describe, expect, it } from "vitest"; +import { buildPrice, priceRules, sellRefund } from "../src/data/buildingPrices"; +import { decodeGameExport } from "../src/encoding/gameExport"; + +const DIR = join(dirname(fileURLToPath(import.meta.url)), "gameExports"); + +describe("priceRules", () => { + it("is the plain game with no research", () => { + expect(priceRules({})).toEqual({ scaler: 1.14, discount: 1, refund: 0.5 }); + }); + + it("reads a player's research off their export", async () => { + const exp = await decodeGameExport( + readFileSync(join(DIR, "gen2_city52_9c43e4b7_server.txt"), "utf8"), + ); + // Standardized Builds 9, Construction Permits 10, Salvage Protocols 10, + // Quantum Replicator 6. + expect(exp.research.BuildingsCostMultiplierResearchSO).toBe(9); + const rules = priceRules(exp.research); + expect(rules.scaler).toBe(1.02); + expect(rules.refund).toBe(0.98); + expect(rules.discount).toBeCloseTo((1 - 0.55) * (1 - 0.58), 12); + }); + + it("clamps a level past the table", () => { + expect(priceRules({ BuildingsCostMultiplierResearchSO: 40 }).scaler).toBe( + 1.02, + ); + }); +}); + +describe("buildPrice and sellRefund", () => { + const rules = { scaler: 1.14, discount: 0.5, refund: 0.6 }; + + it("compounds with every copy and takes the discount off", () => { + expect(buildPrice(100, 0, rules)).toBe(50); + expect(buildPrice(100, 2, rules)).toBeCloseTo(100 * 1.14 ** 2 * 0.5, 9); + }); + + it("refunds a share of the current price, and nothing with none standing", () => { + expect(sellRefund(100, 3, rules)).toBeCloseTo( + buildPrice(100, 3, rules) * 0.6, + 9, + ); + expect(sellRefund(100, 0, rules)).toBe(0); + }); +}); diff --git a/packages/solver/tests/chronons.test.ts b/packages/solver/tests/chronons.test.ts new file mode 100644 index 0000000..8b69205 --- /dev/null +++ b/packages/solver/tests/chronons.test.ts @@ -0,0 +1,222 @@ +/** + * The Chronon award against the game's own: every 1.1.11 sample carries the + * award the game computed, and the formula has to land on each one exactly. + */ +import { readdirSync, readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { describe, expect, it } from "vitest"; +import { + CHRONON_REACTOR_ID, + chrononAward, + chrononMultiplier, + energyForAward, + FIRST_ENTRY_BONUS, + firstEntryBonus, + jumpThreshold, + projectTimeline, + secondsUntilAward, +} from "../src/data/chronons"; +import { decodeGameExport } from "../src/encoding/gameExport"; + +const DIR = join(dirname(fileURLToPath(import.meta.url)), "gameExports"); + +describe("chrononAward", () => { + it("reproduces the game's award in every sample", async () => { + // Every sample but the three written before the timeline section. + const names = readdirSync(DIR).filter((f) => !f.startsWith("city")); + expect(names.length).toBe(13); + for (const name of names) { + const exp = await decodeGameExport(readFileSync(join(DIR, name), "utf8")); + const t = exp.timeline!; + const m = chrononMultiplier(exp.research[CHRONON_REACTOR_ID] ?? 0); + expect(chrononAward(t.energy, m), name).toBe(t.jumpAward); + } + }); + + it("pays nothing at zero energy, and at least one past it", () => { + expect(chrononAward(0, 1)).toBe(0); + expect(chrononAward(1, 1)).toBe(1); + }); + + it("takes the multiplier inside the floor", () => { + // The live save: E 1.77717e31 at Chronon Reactor 3 paid 11140. + expect(chrononMultiplier(3)).toBe(1.15); + expect(chrononAward(1.77717e31, 1.15)).toBe(11140); + }); +}); + +describe("chrononMultiplier", () => { + it("is ×1 unbought and clamps past the last level", () => { + expect(chrononMultiplier(0)).toBe(1); + expect(chrononMultiplier(5)).toBe(1.25); + expect(chrononMultiplier(9)).toBe(1.25); + }); +}); + +describe("energyForAward", () => { + it("is where the award first reaches each count", () => { + for (const m of [1, 1.15, 1.25]) { + for (const n of [2, 134, 6905, 11221]) { + const e = energyForAward(n, m); + expect(chrononAward(e * (1 + 1e-12), m)).toBe(n); + expect(chrononAward(e * (1 - 1e-9), m)).toBe(n - 1); + } + } + }); +}); + +describe("secondsUntilAward", () => { + // The live save: E 1.77717e31 at Chronon Reactor 3, 5.1247e25 a second. + const energy = 1.77717e31; + const rate = 1.5374e26 / 3; + + it("is the time the energy takes to reach the target's threshold", () => { + const s = secondsUntilAward(energy, rate, 1.15, 11220)!; + expect(s).toBeCloseTo((energyForAward(11220, 1.15) - energy) / rate, 6); + expect(chrononAward(energy + rate * (s + 1e-3), 1.15)).toBe(11220); + expect(chrononAward(energy + rate * (s - 1), 1.15)).toBe(11219); + }); + + it("counts 11220 about five hours out, the way the game did", () => { + const s = secondsUntilAward(energy, rate, 1.15, 11220)!; + expect(s).toBeGreaterThan(5 * 3600); + expect(s).toBeLessThan(5.5 * 3600); + }); + + it("is zero for a target the award already meets", () => { + expect(secondsUntilAward(energy, rate, 1.15, 11140)).toBe(0); + expect(secondsUntilAward(energy, rate, 1.15, 50)).toBe(0); + }); + + it("never arrives with nothing produced", () => { + expect(secondsUntilAward(energy, 0, 1.15, 12000)).toBeNull(); + }); +}); + +describe("jumpThreshold", () => { + it("grows by 15% a jump and caps at 5000", () => { + expect([0, 1, 2, 3, 4, 6].map(jumpThreshold)).toEqual([ + 88, 101, 116, 134, 154, 204, + ]); + expect(jumpThreshold(28)).toBeLessThan(5000); + expect(jumpThreshold(29)).toBe(5000); + expect(jumpThreshold(60)).toBe(5000); + }); +}); + +describe("firstEntryBonus", () => { + it("pays once per anomaly, and a rebalance is the same anomaly", () => { + const entered = ["cryo_nexus", "tidal_ascendancy"]; + expect(firstEntryBonus("singularity_isolation", entered)).toBe( + FIRST_ENTRY_BONUS, + ); + expect(firstEntryBonus("cryo_nexus", entered)).toBe(0); + expect(firstEntryBonus("tidal_ascendancy_legacy", entered)).toBe(0); + expect(firstEntryBonus("none", [])).toBe(0); + }); +}); + +describe("projectTimeline", () => { + /* + * The live check this was built against: a save exported at 12:41:17 UTC, + * 12d 23h 6m into its timeline, with 1.5374e26 power across its eight + * islands. The game's counter read 11220 at 13d 4h, and each Chronon after + * it took 4 minutes and a second or two. + */ + const timeline = { + exportedAt: 1792586477, + chronons: 67, + energy: 1.77717e31, + elapsedSeconds: 1119984, + jumpAward: 11140, + anomaliesEntered: ["cryo_nexus", "tidal_ascendancy"], + generation: 2, + }; + const perSecond = 1.5374e26 / 3; + + it("reads the export's own figures at the moment of export", () => { + const p = projectTimeline(timeline, perSecond, 1.15, timeline.exportedAt); + expect(p).toMatchObject({ + sinceExport: 0, + award: 11140, + threshold: 116, + canJump: true, + }); + }); + + it("lands Chronon 11220 inside 13d 4h, four minutes a Chronon", () => { + const at = (award: number) => + timeline.exportedAt + + (energyForAward(award, 1.15) - timeline.energy) / perSecond; + const elapsed = at(11220) - timeline.exportedAt + timeline.elapsedSeconds; + expect(elapsed).toBeGreaterThan(13 * 86400 + 4 * 3600); + expect(elapsed).toBeLessThan(13 * 86400 + 5 * 3600); + + const p = projectTimeline(timeline, perSecond, 1.15, at(11223) + 1); + expect(p.award).toBe(11223); + expect(p.secondsToNext! + 1).toBeCloseTo(at(11224) - at(11223), 6); + expect(p.secondsToNext! + 1).toBeGreaterThan(239); + expect(p.secondsToNext! + 1).toBeLessThan(243); + }); + + it("fills the bar toward the next Chronon from nothing to whole", () => { + const at = (award: number) => + timeline.exportedAt + + (energyForAward(award, 1.15) - timeline.energy) / perSecond; + const start = at(11221); + const end = at(11222); + const bar = (t: number) => + projectTimeline(timeline, perSecond, 1.15, t).towardNext; + expect(bar(start + 0.01)).toBeLessThan(0.01); + expect(bar((start + end) / 2)).toBeCloseTo(0.5, 2); + expect(bar(end - 0.01)).toBeGreaterThan(0.99); + }); + + it("times the whole Chronon under way, and each takes longer than the last", () => { + const p = projectTimeline(timeline, perSecond, 1.15, timeline.exportedAt); + const whole = + (energyForAward(11141, 1.15) - energyForAward(11140, 1.15)) / perSecond; + expect(p.chrononSeconds!).toBeCloseTo(whole, 6); + // 11,140 -> 11,141 at export takes about 230 s; five hours on, the + // Chronons the player timed at 11,223 took about 242. + expect(p.chrononSeconds!).toBeGreaterThan(225); + expect(p.chrononSeconds!).toBeLessThan(235); + const later = projectTimeline( + timeline, + perSecond, + 1.15, + timeline.exportedAt + + (energyForAward(11223, 1.15) - timeline.energy) / perSecond + + 1, + ); + expect(later.chrononSeconds!).toBeGreaterThan(p.chrononSeconds!); + expect(later.chrononSeconds!).toBeGreaterThan(239); + expect(later.chrononSeconds!).toBeLessThan(243); + // What is left of one is never more than the whole. + expect(p.secondsToNext!).toBeLessThanOrEqual(p.chrononSeconds!); + }); + + it("never runs backwards on a clock behind the export", () => { + const p = projectTimeline(timeline, perSecond, 1.15, 0); + expect(p.sinceExport).toBe(0); + expect(p.award).toBe(11140); + }); + + it("has no next Chronon on a board making nothing", () => { + const p = projectTimeline(timeline, 0, 1.15, timeline.exportedAt + 999); + expect(p.secondsToNext).toBeNull(); + expect(p.chrononSeconds).toBeNull(); + expect(p.elapsedSeconds).toBe(timeline.elapsedSeconds + 999); + }); + + it("refuses a jump below the generation's threshold", () => { + const p = projectTimeline( + { ...timeline, energy: 87, generation: 3 }, + 0, + 1.1, + timeline.exportedAt, + ); + expect(p).toMatchObject({ award: 1, threshold: 134, canJump: false }); + }); +}); diff --git a/packages/solver/tests/gameExport.test.ts b/packages/solver/tests/gameExport.test.ts index 0cd9187..d5eaa6e 100644 --- a/packages/solver/tests/gameExport.test.ts +++ b/packages/solver/tests/gameExport.test.ts @@ -6,11 +6,13 @@ * three saves: city level 23 in a first timeline (five islands, early * buildings, most obstacles still standing), city level 34 in a third timeline * (Cryo Nexus, Time Lab research, two islands still locked) and city level 47 - * in a first timeline (everything unlocked, one research running). They are the only evidence of what the game + * in a first timeline (everything unlocked, one research running). They + * predate section 7; the `gen*` samples beside them carry it, and have their + * own block at the end. They are the only evidence of what the game * actually writes, which is why most of what is pinned here is pinned against * them rather than against codes built in the test. */ -import { readFileSync } from "node:fs"; +import { readdirSync, readFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { deflateRawSync } from "node:zlib"; @@ -53,6 +55,18 @@ class Writer { this.bytes.push(...b); return this; } + i64(v: number) { + const b = Buffer.alloc(8); + b.writeBigInt64LE(BigInt(v)); + this.bytes.push(...b); + return this; + } + f64(v: number) { + const b = Buffer.alloc(8); + b.writeDoubleLE(v); + this.bytes.push(...b); + return this; + } str(s: string) { const utf8 = Buffer.from(s, "utf8"); let n = utf8.length; @@ -165,8 +179,12 @@ describe("decodeGameExport", () => { await expect(decodeGameExport(city34.slice(0, 1200))).rejects.toThrow(); }); - it("ignores a section appended after the six it knows", async () => { - const w = tinyExport().str("a later section"); + it("ignores a section appended after the seven it knows", async () => { + const w = timelineSection(tinyExport()) + .f64(1e6) + .f64(5e4) + .u8(0) + .str("a later section"); const exp = await decodeGameExport(w.code()); expect(exp.islands[0]).toMatchObject({ areaId: "area_1", @@ -174,6 +192,170 @@ describe("decodeGameExport", () => { minY: 4, cells: ["TileGrass", "TileWater"], }); + expect(exp.timeline).toMatchObject({ + generation: 3, + cash: 1e6, + researchPoints: 5e4, + stampSource: "server", + }); + }); +}); + +/** + * The worked example of `docs/game-export.md`'s section 7, plus the generation + * field the game added after it. + */ +function timelineSection(w: Writer): Writer { + return w + .i64(1792540800) + .i64(6200) + .f64(5.14e29) + .i64(2592000) + .i64(6905) + .u16(1) + .str("cryo_nexus") + .i32(3); +} + +/** + * Section 7, the timeline. Saves the developer exported from 1.1.11 for this + * purpose, named `gen__city`; `gen2_city52_9c43e4b7` + * and `editor_current_save` are a player's, and a `_server` file is the same + * save stamped by server time rather than the device clock. They are the third + * round, which ends with the clock byte — except `owner_editor_save`, kept + * from the second, the one real code that ends at research points. Only the + * figures are pinned here — the award is the game's own, and whether our + * formula agrees with it is the Chronon module's to test. + */ +const TIMELINE_SAMPLES = readdirSync(DIR) + .filter((f) => !f.startsWith("city")) + .map((f) => f.replace(/\.txt$/, "")); +describe("the timeline section", () => { + const sample = (name: string) => + decodeGameExport(readFileSync(join(DIR, `${name}.txt`), "utf8")); + + it("is null on a code written before it existed", async () => { + for (const code of [city23, city34, city47]) { + expect((await decodeGameExport(code)).timeline).toBeNull(); + } + }); + + it("reads every figure the game wrote", async () => { + const exp = await sample("gen1_cryo_city41"); + expect(exp.gameVersion).toBe("1.1.11"); + expect(exp.timeline).toEqual({ + exportedAt: 1792610302, + chronons: 553, + energy: 8.906078559870158e25, + elapsedSeconds: 1841407, + jumpAward: 2051, + anomaliesEntered: ["cryo_nexus"], + generation: 1, + cash: 3.001636196701361e30, + researchPoints: 7630000001250, + stampSource: "device", + }); + }); + + it("reads a player who has never entered an anomaly", async () => { + const { timeline } = await sample("gen0_none_city2"); + expect(timeline).toMatchObject({ + energy: 23814, + jumpAward: 2, + anomaliesEntered: [], + generation: 0, + cash: 13926.60626791145, + researchPoints: 0, + }); + }); + + it("names Tidal Ascendancy plainly when the header names its legacy balance", async () => { + const exp = await sample("gen6_tidal_city49"); + expect(exp.anomalyId).toBe("tidal_ascendancy_legacy"); + expect(exp.timeline?.anomaliesEntered).toEqual([ + "cryo_nexus", + "singularity_isolation", + "tidal_ascendancy", + ]); + expect(exp.timeline?.generation).toBe(6); + }); + + /* + * One sample is not clean, and it is the game's save rather than our map: + * `gen1_cryo_city41` has a building standing on the transformer cell of + * areas 6, 7 and 8 (a chaos core, a psionic tower, a cooler6), where every + * other export writes `CantBuildHere`. The import drops each one and counts + * it, which is the rule — pinned so a fourth would show. + */ + const ON_TRANSFORMER: Record> = { + gen1_cryo_city41: { island6: 1, island7: 1, island8: 1 }, + }; + + it("reads every sample, and every one resolves onto our maps", async () => { + expect(TIMELINE_SAMPLES.length).toBe(13); + for (const name of TIMELINE_SAMPLES) { + const exp = await sample(name); + expect(exp.timeline, name).not.toBeNull(); + const r = await resolveGameExport(exp); + for (const island of r.islands) { + expect(island.blockedBuildings, `${name} ${island.templateId}`).toBe( + ON_TRANSFORMER[name]?.[island.templateId] ?? 0, + ); + } + } + }); + + it("reads the spec's worked example byte for byte", async () => { + const exp = await decodeGameExport(timelineSection(tinyExport()).code()); + expect(exp.timeline).toEqual({ + exportedAt: 1792540800, + chronons: 6200, + energy: 5.14e29, + elapsedSeconds: 2592000, + jumpAward: 6905, + anomaliesEntered: ["cryo_nexus"], + generation: 3, + cash: null, + researchPoints: null, + stampSource: null, + }); + }); + + it("reads cash and research points after the generation, debt included", async () => { + const w = timelineSection(tinyExport()).f64(-2.5e30).f64(9.15e11); + const { timeline } = await decodeGameExport(w.code()); + expect(timeline).toMatchObject({ cash: -2.5e30, researchPoints: 9.15e11 }); + }); + + it("reads the clock byte the game writes, and its absence", async () => { + for (const name of TIMELINE_SAMPLES) { + const { timeline } = await sample(name); + expect(timeline?.stampSource, name).toBe( + name === "owner_editor_save" + ? null + : name.endsWith("_server") + ? "server" + : "device", + ); + } + }); + + it("says which clock stamped the export, and not a clock it does not know", async () => { + const read = async (source: number) => + ( + await decodeGameExport( + timelineSection(tinyExport()).f64(0).f64(0).u8(source).code(), + ) + ).timeline?.stampSource; + expect(await read(0)).toBe("server"); + expect(await read(1)).toBe("device"); + expect(await read(7)).toBeNull(); + }); + + it("refuses a timeline that was cut off rather than reading half of it", async () => { + const w = timelineSection(tinyExport()); + w.bytes.length -= 2; + await expect(decodeGameExport(w.code())).rejects.toThrow(/cut off/); }); }); diff --git a/packages/solver/tests/gameExports/editor_current_save.txt b/packages/solver/tests/gameExports/editor_current_save.txt new file mode 100644 index 0000000..3d09924 --- /dev/null +++ b/packages/solver/tests/gameExports/editor_current_save.txt @@ -0,0 +1 @@ +R2X1.jVnLjxw1Gnd193S5ZpkkDEF5TF6wq-WAQMqDJFfoEIhElDATgZCQSp4qd7eZ6nLhqkrS_CFISBw58A8gcVwt2gMnTgghTpxACGlXu3sAaUXhZ9lV7e7FIKbt3-fv-fNndzO-_CL_5_KpiqQoi1GZ4DxFebKMMzxDyTLYjh6QDL-NKszkp9cYKkt4FxXxPk2OnhYfblOGyyqe0JxMMaN1edJZvYUTktZ8Ue65T_N0Z4Ly6pWaZOnrmOEwoTTD7OZxnFQ0Tuii4NtKyrZnOMcMVZTdgGPEMIovB_9rfmme2AF8QAjMiMTQH8OI_wvH8jOEAoACgvwPn3J0KIUEFMKB3gv1fghDIcc_CalIzBwbYHUMR85EfVaeXgkG4IfmxDEjN_Bs9g_pjZ0Kn4W71g0ZVKQ94y4Kj0VgkYpZei3wkJsNeKxQxi7RgRSIpLwxMI5CjQ-1CYHa5Hpjb2EV7dXgn83PzbHjwBgyG4V3oF2KVHXGJjKdejUR9ZH5lyUJIwPDEOoFFaWqXSSjAtIclFraiKCigPW94z7PpIJGgePoYChmKgGdUqn4rgX_ar5uTp3s5GAIfGOwNfKud8fIu7_PkhUJlclRT8zwoy9uI1cbdG1gp76RTpYhlrEU6rnKuyMup-o02bzCtijy1LiuSXKpv-aIAFFUaDCHatoJ6PJTjLGpeo-Imvqww9Y29pVF4PJaVfal4Lvm2-bkWdD69odGFPVNyrh7NgVzRaR6qqtguC1ngbSq-5RxTzNT8V03MzOEyjb1hsJtqVzBUHnkrunOoc5cELSLUGc8CPSi6oOKMGZNWIBaodmqaiK3tv6pUjlmjVDHu7brdHPoKZtLPzlGUrQvtnZ4ibDKGC4IDCuuB983f2tOn_YIeEZXmWwkI7_hoL-wZg24vcDnqlLf1y8zbA6EbRLqoDm00a1CnsuwraA79Dk2dQw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WKYFysRxsbgWaa9jg91mWIuRBao4hSOC86uagzOe4RYYvwbg4ur-CGhC1SWRsNfPBIZSo7iOc2wVXRuVYx7T8s4oQz7YYoyY-SMDxY_hl3egF3ZgF3dgF2D67GXovXY9T-tx25s2HdzAC6tYil5yA-vTaCnnCmli4MKMSv0zKpQ78fCMbiwKjPN6sdWiceZaV0SS9sx2FsVaX-EDH3FbNEr3lq38FW4Eb62eTevzib4-mb4BvQleYZpNcdsYcnoSfKMoYek4md7w6mY44z0VXmO33yZMmpwjz_zZcGPb1mgBOuz47GV45orEf1jIzfyml8fLn_-vCrDeZPUjDMnLpYMLUjqbQqF4AdJ4oo-wn5btkWt7wglqkUO8RJ7U8P7Lne2QDnOvLj6YV6mDvho_oiI9lyzQ36wtnxpEx09LsTVYd3cbcVmqG16O2XFH0HcmSllM7wNduVO0b95vmhFE5ptA_E-_U_zS_PJ6wD8u_m1-ewdwOe_NhfeBODD49--J95lE_0---27bz7_6r-L2x-VT8r5j8-r9QHYTtiS8oI-rssT_f_zIL5YFf9494vxg89f--1j8FP19vuT4Hc \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen0_none_city2.txt b/packages/solver/tests/gameExports/gen0_none_city2.txt new file mode 100644 index 0000000..ded183f --- /dev/null +++ b/packages/solver/tests/gameExports/gen0_none_city2.txt @@ -0,0 +1 @@ +R2X1.lVhLbxw1HPeMPWkqNS1UqfpInzxPgNL0dWxJW6hE1JBUcBw5s96syex48MykDScOfAo-ASc-A4IT4oxQ4cSJCxJw44C0-D2eGe9SJtLu2L-__8-f__Zmaf1t8beOClYQcPz4E5qTj3FNuHp7j-OqWt7CZbrDsoMz8uUh46Sq001W0DHhrKlWvdn7JKOjRkyqNdusGK1s4qJ-t6H56H3CybGMsZzw9RNPaTFK64bv0YIsL2FOcLoe_TP7e3ZiBYgHQWCfaHl5GZnXaPmYGC3Jdyjn5ci-y1EMpbycXU5gLN4TOXtMrzdS8k0gKIogcjbi1l77tLj0SH1qT6-DGPw2e-mkl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f5jQjO2TUZDVlhS9y0YrskjzfIeOmGPnwNQtXm6yqt5q8pmVOCfdlXt7E1WQTl_7c-U1aH90nU1yMjO0WOymxdiIGF-TEbsPLvKkG0hfFD-ma46zewlR4_hTzjoNnLbybs7rykSsWeUKn4dgv3Cclq2hdPSrE73nx89wHz1mwp_iq0GyhuZrPPOSE7JZEYJ20XHlU5W1KBguF7kuP96oaZ7mAp-wQ59qEl9jH43FOC_IA80KWxccufdjQ7EBWI1yoNYXvlGH0TTuwJZ8b3Rt28CBjBZsezRVcs4NtRou66nHkchd9VGSsG-tbdtBTw2SlAubOS0c-wHu7B7TsckzQ6CM6IuzeyBSln9YVvFexvKlJ-hnhDIBVCdBDUqV75IjJf8WIBQCcziZchJziLCM54bhmHIBTerJIxZmTqZmXBFSRUTrmbGpWrtBiTAsqDOxzOhLjciJE0j2x5oDIJZ82uKibaUqeZRNc7EtjdooTUaxMG3uFG6_TPVOmVAjRKa4FhdNSsKsWRAgI8az178oQ36NsiqvKangtIJHj7CCdsJy0ii4OxYT3rEozxkkYZji3Rs6HYPXvLzgfu75g3cYC7MYC7OYC7NYC7PYC7I5ov0NsRA_F5m0TGCjniLHpbo15K3RtKEQEIgxNSwFVUubyUGacN89aJQFnxk1FfdquDUX2SWFpHiimQ68vhjcWwzcWwzcXw7cWw7eDSd4nrJ4QPm3JGEjyPseHtBZ7e8GumJCc9lUFtt_kaMSZxQP-TI5KsX2rEmfE7J2ArYI0QonsHwu5UTTi-PD58-pQRvAma7hgTloecTyVHSnQFErJD5qlNXtKwrbaFjW_I1S4kTkkRySYGtF3hbMlLkgexGs6alMboLn_n_IklDbZ0dNSHh2tm6ed2D52TW-lqsUlSDgzZlw1YLVS9m-RL1azjOX63vXXqeef9G9mn9_76e4XX-v37o-T139-58utjR_uujvcvw \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen0_none_city2_server.txt b/packages/solver/tests/gameExports/gen0_none_city2_server.txt new file mode 100644 index 0000000..682f30b --- /dev/null +++ b/packages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C0jxQTIdeWQ1fXQ1fWw1fXw3fWA3fDCZ5j7B6Rvi8JWMgyXscP6W12NsrdsWM5LSvKrD9ZgcTziwe8Gd2UIrtW5U4I2bvBGwVpBFKZP9YyY2iEceHz5_XhjKCN1nDBXPS8oDjuexIgaZQSn7QLK3ZMxK21bao5R2hwo3MITkgwdSIviucLXFB8iBe00mb2gDN_f-UJ6G0yY6elvLoaN084cT2sGt661UtLkHCmSnjqgGrlbJ_i3yxmmUs1_euH4-_-LR_M_vizs-3x1_r9-6Pkzd-effLh1d_uO0m_gU \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen1_cryo_city41.txt b/packages/solver/tests/gameExports/gen1_cryo_city41.txt new file mode 100644 index 0000000..62483f1 --- /dev/null +++ b/packages/solver/tests/gameExports/gen1_cryo_city41.txt @@ -0,0 +1 @@ +R2X1.lVnNj9xIFS-3Pd12984kRFnlY5JNdlmB9gBSPnZ2r5tJwkYiJMysQOJi1djV3d5xu0zZTjL8BfwP3DjxH3CF5cQfANIKCYkTFyTgxgFoXn25yna52a1u9VS93--9evXq1Yc903vfhc-9ecIuaFyQN02F3oo-y3LyY1wTJmrfY7iqwue4jE9ocv42rzyljFR1fEyLbEkYbaqrlvQxSbK0AaHQeUmLdP8YF_WjJsvTTwkj82SNaRUnwJ4llOaEHc1XpCAM15Qd7ZdVBmaTuKavCZtXuGG0iMkFCaeYERzf8_69_df2rX0ExfOQLh4vshp5Hv9OW7GC2roXIjSP5nNB5HVRlH4oW7ymWHPdhxT3SxjaDfErPb3vTdBft5cPXLzdJZrNoplpzlTpNSMliWaCP9NKM6uIblu-8rDl6w6mht06ABTbpY5DUtJqi9E-8P6-_dv24BJ02I2IaC8WdjNaTE1rsVhEixaCOrRlXWGLhW4JbNHFkOhOY6oXjamWtNkWqC9U911HkQ6AZ8nV-B56_9j-YXvtaicGPnKVyV7glHdL4NT3J712nyB9DiZ9qXS_T9dycEr82qFuB78QBf6GHTlw1cdFb6dFi0fYqM_2uvQeG9lseyR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_5yOjm6Fu68SShBd1cjBIPdeMlzYq66uTIAXqniz4rEmqP9QB9Rzd6ZiifKUfUb3BHvo_PTs-zsptjkEY_ylJCP0nVpPTDuo_PKpo3NYl_RhidoascyF6RKj4jF7RI4xoUpuhKsmYw5BgnCcnla5spuiSFRQxnTgKSCboMUEXSeMnoRmjuof2sWGZFBh2sWJZCu1wDJT4DnXMCRi7_tMFF3Wxi8iZZ42IFKle0iBGYrIR3FqD3mPI6PlPTFAMp2-AaUjguIbvqKbrtILFE-zdFd4b4WUY3uKq0hfcdjBwn5_Ga5sQYujWkmVdcbpjiXHdywwXzt2L3dmD3d2APdmAPw3Hsw2gcO5qNYx-hcexj2H6HWJq9gsVrAuiYzpTSzWmNmSYh9O6QRACBjjYlQBXnvDPkLPPmjTHicGbZ8BeOxpnDIaV9OzlzTWaL3nfOdQs_CHfCD3drw-zsgo92uwZz5AjyitB6TdjGJKMjyCuGX2U1fwk7virWJM_6phzLb32RMqpxhz_rixKWb1XihKi14-irIA0Y4fvHztwoGjg-TP5M0TeHHMibpGGQOXF5wfAmS5FrU-i8kPZdfZktanxHMC-yPVdoYN8FZ0tckNwZujpLdWidaf4649tzw85gYe25wsZ39LjkR4dx80pLW-F209uvargEgTNLylYkRFeEJt-_IV60pgnN5f3rv5e-_Jz__UBdjasfvPfrP35-8mR7_Za82Ok3RMj67wJ_Z_OTP3_6y9U_Hz1FPz_-4j-__cUj738 \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen1_singularity_city50.txt b/packages/solver/tests/gameExports/gen1_singularity_city50.txt new file mode 100644 index 0000000..65d7316 --- /dev/null +++ b/packages/solver/tests/gameExports/gen1_singularity_city50.txt @@ -0,0 +1 @@ +R2X1.lVnNj9xIFa_qdrf7a5JJlCgfk69dVnBY7YpMsplInJbJZgkiJMys2KPlsauna8ft6i3byQ4SV84c-CM4wh-AQMuJP4DDwgkuXJAWceKA1Lyqcn3Yru6w5ZbHVb9X7716X1X2DO-_D9f9qwXNT6ss5rQ8j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XtITc3pIVC5LRNitP-i3OU8407tFncb6C9C1WcULq3PHIykkFTET9sD7zqJ1XsH3Y-Bmib3VpOt-YA19RWIn4oElUstfEL8uWqM0VoYgrYUNyDmXQYxrxUR7UiHOSeU1X0lSbFvnC_DUV5bniJ5BYA5_ZREWPVmLrsGpeNmSnsSl6O0UJhyBQZs64LMBypqjfYC9WsoRlIziBvTkd9Yl5svvVZ-LvL-r-z3_328-__P2jp7_5yy3Z_-Udfarz_59CnPbe_no_-96Pzz7--zu_eveH__7uIf4f \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen2_city52_9c43e4b7.txt b/packages/solver/tests/gameExports/gen2_city52_9c43e4b7.txt new file mode 100644 index 0000000..e87a6fe --- /dev/null +++ b/packages/solver/tests/gameExports/gen2_city52_9c43e4b7.txt @@ -0,0 +1 @@ +R2X1.jVlNjxzFGa6emZ2uXlh7WYz8sTY2JAKJL8kf2D7kAmPsWIrlzS6C5NSq7a6ZKbanq6nutj38jxwiceLET8gRwYkfwAFx4hQFIYGSHIwUpVOfXdU9NRMKxE7V89b7-dRbNcP46lv8n6tnK5KiLEZlgvMU5ckyzvAMJctgO3qfZPhDVGEmP91jqCzhA1TEhzQ5eUF8uEsZLqt4QnMyxYzW5Rln9Q5OSFrzRbnngObpzgTl1bs1ydLfY4bDhNIMs9uncVLROKGLgm8rKdue4RwzVFF2C44Rwyi-Gvynedo8uwP4gBCYEYmhP4YR_xeO5WcIBQAFBPkfPuXoUAoJKIQDvRfq_RCGQo5_ElKRmDk2wOoYjpyJ-qw8vRYMwN-b3VNGbuDZ7B_SGzsVPgt3rRsyqEh7xl0UHovAIhWz9FrgITcb8FihjF2iAykQSXljYByFGh9qEwK1yfXG3sIq2uvBT82PzanTwBgyG4V3oF2KVHXGJjKdejUR9ZH5lyUJIwPDEOoFFaWqXSSjAtIclFraiKCigPW94z7PpIJGgePoYChmKgGdUqn4bgQ_N980Z890cjAEvjHYGnnXu2Pk3d9nyYqEyuSoJ2b40Re3kasNujaw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Mv6y54zoA9xVe4ZgOt1fzCXYbxUYE55qRlB1y-X2Y2JSsbrwBw6eFxWaEk4_CCPkKZMmEEQnD-4XSakRy_h1guymKxAFz6Y02SE1ENX6EA2Jf4YeFHXzUTU_I10e2AV8zkvYTmdLFcK7hvJgeU5FXZ48iLXfR-nlA31j3wppn01FBRKU_WzwtH_oCOj05I0eUYp9EHJMX0nVQXpZ_WHXRc0qyucPwJZnQLnBEAeYTL-BgvaZ7GFd8AwV4yZzzkGCUJztSvMxCcVot5zO-chK8MwS6HSpzGU0YXcucW2CH5lOSEG5gxkvJ5Meci8THfc4LZGOx-XKO8qhcxfpLMUT7jW_bMEsO8WIkwNgYvM-11fKzLFHMhskAVp3BccHZVY3DJI8QS498YXF7FjwldoLI0Gn7rkchQchLPaYatoourYtx7WsYJZdgPU5QZI-d9sPgx7OoG7NoG7PoG7AZcj70drcduPrMeu7Vh3-0BuLKKpeQRP7w2gZ5yppQujirErNBLq0K9HwvH4MVVmWlWP7FKPM5M65JY2o7B_qpI-yNk6Ctmi17z1rqFr8ON8I3Nu3l1NsE3N8O3oC_JM0yrOWYLS0ZPkmcMPSIVP9sbTsUcZ6SvynP85suUUYN7_JkvC358ywIlWJ8dj60c11yJ6B8buZHX_Ppw-fObVRnOm6RmnDlxsWRoQVJvUygEP0gSV_Qx9tuyLWp9RyhRLXKIl9ibGt53ubMFynHmxdUP8zJ1wEfzx0S055od84O15Uub6OhxIa4O6-ZeKzZDbdPbKSv-COLOTCmb4W2wJ3eK_s3zRSua0GwbiPfpv5qnzb_vAfDP5pdm68-Az39p6AEAd3e__Ui8yyb6ffaX136X_fXp4u796jk5_8fran0AthO2pLygT-pyt_9_HsQXq3vJZ_kbf_rbvf9-Cn6oPvx4EvwP \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen2_city52_9c43e4b7_server.txt b/packages/solver/tests/gameExports/gen2_city52_9c43e4b7_server.txt new file mode 100644 index 0000000..4c752ca --- /dev/null +++ b/packages/solver/tests/gameExports/gen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hn2wxRlxshZHyx-DLuyAbu6Abu2AbsO12OvROuxG8-sx25u2HdrAC6tYil5xA-vTaCnnCmli8MKMSt0eVWo92PhGLywKjPN6idWiceZaV0SS9sx2F8VaX-EDH3FbNGr3lq38DW4Eb6-eTevzib4xmb4JvQleYZpNcdsYcnoSfKMoUek4md7w6mY44z0VXmO33yZMmpwjz_zZcGPb1mgBOuz47GV45orEf1jIzfyml8fLn9eWpXhvElqxpkTF0uGFiT1NoVC8IMkcUUfY78t26LWd4QS1SKHeIm9qeF9lztboBxnXlz9MC9TB3w0f0xEe67ZET9YW760iY4eF-LqsG7utWIz1Da9nbLijyDuzJSyGd4Ge3Kn6N88X7SiCc22gXifftt818R3Afim-b4p3gd8_n3zlF8yX-w-_aN4l030--y_yy_-8NcfFne-rJ6T869-rdYHYDthS8oL-qQud_v_50F8sXr1H39-7cPff3T3f38BX1XvfTAB_wc \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen2_cryo_city34.txt b/packages/solver/tests/gameExports/gen2_cryo_city34.txt new file mode 100644 index 0000000..761d876 --- /dev/null +++ b/packages/solver/tests/gameExports/gen2_cryo_city34.txt @@ -0,0 +1 @@ +R2X1.lVlPj9xEFq-y3f-mp6eHKJBMJiGBXS0nkPJnAseFSYBIG2WYiXa5WR67eroYt8uU7STN5-ADwG0_AWJvaDmh3QMS4oA4ceKwK7FHDkjNqyqXXbarG7Y60-16v1-99-q9V296Kv2br8Hr5lbIl8xPyLMiQ7ujxzQmfwtywuXTOzzIsuHDIPWPWXj-vHh4m3GS5f4hS-iMcFZkFw3pPRLSqAChXHPEkmhyGCT5WwWNo3cJJ4OQsZjwg_Lz7k5En9CE-JwEYc741hlJCA_g6U79eDA948ETmnOW-GkM2nbny5RwP0uDkPghGJ5-WIC4WGg1Fz4Cx_yU0STXomE_gCf_Jv5l9fNqe4JgDIdIj9FopGfj0Rieh_1SLJFhKZfIcKCBkXrWSL1iBE8VYthA3TEYmBP5rjy9hR3042p3x8bbPPA2xlv1VM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DYnS5OyI05Ack6gIc8qSmjJEVzXlhMTxMZkVSWTCL2k4O2RZ_rCIc5rGlPCa00PPHQbZ_DBIa9k22juk-fIeWQRJVNqude4IrBa8jK4IwUnB07jIWmyErsIf6zmHv4MfBhQ8fxrwyIQvafgkZnlWIx66rpHHdGHbO0JX7pGUZTTPHiQ5EVcAJnhZgy3FN0CzhtZqfv5tTshJSgAzwrKFrj_I4joknYU3ELr26DTLgzAGeMGeBLEyoQl9tPdoNotpQu4HPBFpqTGMrr1X0PBcZMOWKIT2JX6c2tFX9ESnfM3uhuhPenI_ZAlbLNcS9_XkSFxnZK0aebGJPkhCZu51G72qJy01TGTKEvU94chfgtOTc5o2awzK6K80IuzNqExKM6wDNAlOMxYXOfHF9UsPXRQAfUIy_5QsWRL5OSzoowvhnMOW_SAMSaxueDw0VcJEX9c4aBegjET-jLOFXNlDE5rMaELBwBmnEczTOVD8U1hzTngf7eprIPIsnAfJGSy5UN8MQbJCYcxFL_PSa_-0TJMPJLoIcihhdcXUR9csJB5q__roehc_pWwRZJnW8EcLIw7Cc3_OYlIrutqlgfcskzdbyAqzINZG9mywuFq7uQG7tQG7vQG7M1yPHYzWY3fxeux1tB57A9pvF2teGWJbOiPGFid5wDUJoZe6JAIIGFqkAGWC82KXM4uLZ7USizOzIqN12fbRfpdSXWQObMms0FvWUqjg28ON8J3Nqw82r75rrbMKhhxZgnxGWD4nfFEXoyXIratb66mYk5i2VVmO33wZiVtdhVv8ad8KW20lpAAlon9srI2kgF8fdf300R-6HKibsOBQOX665MGCRsjWFFJRHzT0c_aU2G21Lq-ticyCQsSQLKEjWEIDfRecTYOExNbQ5TTSobWW-VMq2nPBT-Fg9Wxh616oQyOvaGdB1fQmWQ5fgsCZGeNnotvLlaJ_Q7xYzkIWq5uTF3a_-0B8_rn8avz-Z_8--s_nn9z7xzt7cv5NKXeQ8f8Tu2ojQRaSJAqScClIX3v_uvCT599HX3yM3_30g7fwrw \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen2_singularity_city32.txt b/packages/solver/tests/gameExports/gen2_singularity_city32.txt new file mode 100644 index 0000000..dfb7890 --- /dev/null +++ b/packages/solver/tests/gameExports/gen2_singularity_city32.txt @@ -0,0 +1 @@ +R2X1.lVnNj9y2FSdHHzOenZndLGz4Y-3YTpP01AS2d-0gt2TtNAa6sLObtEAvAkfi7DCrESeUZGf7F_XPKBogQM9FDkF7yamXAs2p6KHA9JEURUnDmaRc7azI3-N7j-_9-Ebihg_eg58H13KWnZcpEay4jFjOU1IwnqG9K5-zlP6OFFSou18LkueDE7KMTnl8cU3efMIFzYvomGdsRgUv86uN0ac0ZkkJg2rOS54l42OSFR-XLE0-pYLuQYctSAH6o2UKnf1pSuKLaM5TGglK4oKLfsyhJw6rv0fDc5pRQQA5tLdHu-eCvGKF4JlWtDe_XILSfEliGsXgzf4fwLtoyVlWGM2DkMBd9AD_d_Wf1WiMoOE-Mg3j_k7Vu6IaDuU9DMJ9vy8h-IQuXNhT8n0J4Z6811N8rVPJwJ2np_T71gZG683zGx19rz19CLr_sdqbGLmeY7K7YdwyNR6Psfw16M5wR_6Od8a6P65-hloEV_KAQ9_DqJLXKsELI1-bCLGag9WatQNSvukS4B0n62Xr1T7C_1r9czXZBYN40FrLCBTXtgbDgbzCqjcaqGuoJAemYTRoNNA3GtYXxm1MZwWbiU29bZtNl5CG_OYSeyqROgCtVOn1HeIfV9-trl9txcBDrtYLfOd4u1lrLY0dlqxJ9JTPfkfMrxjTFZfDWlR_VmnELYaZbGPcGseaJNAmE7gmtbjiihweDSc6dcoFRTElPYSrdsEowRWHfeuZbm2qYaMe5jVXEkoxBbWDK9XX5G6vvaOhGm1EWGf2CP9t9f3q6i3U4PTPaOvVQC-nrQN7rUFt269WrrOlQd8Maq24qRLjcN1ONR13BrFD0DkmB3udZPjStwCvTcZVkdsdDu1cPdXbHQ0rZ6wru3jYNuvBTDm5yU8MM-XkVrxgJlyo04JusH1lpiu2sfkOUed0qVez4jH-YfWn1Y0bHQH3ju_sR7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iXT2YmeMahPYAymkSzQRfqJkYjVk2YxkDA-eCJdBfzkEkmsKcCyow2vuqJFlRLiL6dTwn2TkN0L4ZEhSSFUtjPfSWqLyOplWaou7ZVIjuOIREbPwL0d11fMr4guS51hCgtx0SaydeIbq9Lgbe81ydZCEnzElq3LzpguXZ2YMt2MMt2KNgM3Y42IwdbcEeo83Yky3YB1B-17GEvYLNa5niSGfC-eKsIMIK3V8XooCAocUSoFzKvLkuM0vLr60ShzOzMmeWtiE6WBepDy6dua7Rh9vhR4Ot8OH22UfBVvixk2c1_MQZ5HPKizkVC0PGwBXkzlFt6NoVc5qyrirH9ptfJvJUV-MOf7qnwE5bGS1BiawfW7mRlfD1YfkTol-sywBv4lIAc6LlpSALliBXUVhKfrA4Kvhr6rZlS9TmipCTUsaQXkJFcIRGHuKDGySjqe_CC5aY0Dpp_prJ8lyKKWwsZ-FaP1Dvof1a7JzURW-cF_AQBM7MuDinIKRmyvoN8eIFj3kawBPYzzJhHu3e2vv-S_n30-op-sf9H74YfUie3v_9vup_ax7qkftfG3Ladxf__vvJ--88Q-jsw7-ePPsY_w8 \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen3_tidal_city31.txt b/packages/solver/tests/gameExports/gen3_tidal_city31.txt new file mode 100644 index 0000000..173da18 --- /dev/null +++ b/packages/solver/tests/gameExports/gen3_tidal_city31.txt @@ -0,0 +1 @@ +R2X1.jVnNjxtJFa_qL8-0x_ZslFUymWSTAIITKyWZSVbcdmd2l0gbJcys4Nhqd5fHxbS7muruJObCgRtH7lw48WcgOHFF4rDaEwiJCwLEiQOSqc_u6u6ySY1id73f-36vnu1K8OhD9vfosMJpnEVxmaA8jfNk7by3_yXO0I_iClHx9DmNy3LvRVxEFyS5fp8_fEYoKqvojOR4gSipy5sG9RwlOK0ZUci8Ink6OYvz6pMaZ-n3EUU35lmcXEdLkqGIojipCB0lhO3oI_V-ot5PwyuUIxozjpP28XR2RePXuKIkj4qMaT5crgtEo7KIExQlzInZT2pGrlda_c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oGsJDk85vli1QkIZm88f7w8Ksf8_c_qq_Gfz36xc_ffv35-S838hb8V_qbOhj8XwX_yvfvn_3le_N__PocgC_Ws_HDT-D_AA \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen6_tidal_city49.txt b/packages/solver/tests/gameExports/gen6_tidal_city49.txt new file mode 100644 index 0000000..94787ea --- /dev/null +++ b/packages/solver/tests/gameExports/gen6_tidal_city49.txt @@ -0,0 +1 @@ +R2X1.jVlPjxxHFa_a6Z3q7mSdtWXLf9YbOxDBCaS1HW_ELazjYCmWzW6AA4dWbXftTGd7ujrV3bYnh5z5DOELcELKN0BwgjuHCHHggLgggYiEOICGV6-6-t_UbFLr3Zmq36v3Xr33e696xtOD78PPwfUqTXgW8TIWecLzeBllYsbjJX0t-CjNxM94JRS--0DxsvSf8iI6lvH5Nf3msVSirKIjmadnQsm6vNpbfSTiNKlhEfc8l3myc8Tz6od1miU_EkqwWMpMqMPdRMrFScVVpASPK6nCmciF4vDu8HKhRFyrUqqoWCq-SBN_ykEsOqD_Xf1n9foOgeH7xA4WMDujPvMD35-iREApZQFCIBAwymA2AYBRjTB_SwvBMuxnuIPBFj-Ad1rKb_YSY46R9THxehPz3nh6j26Rv612L1m5Lcdm9whZGPZMsSCEHxbaKWMh_Abwz0hrMAi1RGjxEP8EoGRCCaLwiyrBC42CcKuQTAMNo3RjItQyA5eC8dnbuTntffqP1d9Xl96AAPbSQrRxmLdLGNCATe2M6X8BovAKW2Gq5QOtJtAvII9iASK4HZeMMCNoDhZQurXCWOeGr0PV80nrxzce7Tm6hYk0ARikypzvAf3n6o-r61cHMZgQ19ja9pzrw9FZG2gcsWRNwmTRG4lBejCdY3Gm82qcMnOzPUCCdJtDlAqRMkHHswBZFOJLl3_NHIA03YIeT7WY5hEbShsyGzaitNeKm5VwIK3Zi-wMBiWgOcqMpta_Rk9D__XSZMyxSPr7TWbfoX9afbm6eou0vn2jMaS5HqbvDFc1pzVVm2mTBeSy7SwUrSKBkd9m0aoMkPz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TuxKd9wupB8x07ej2UuF8uNgnt28lymeVWOOPLmEH2Sx7J_1svke3YyUiN1phxRv6kd-ZCfnpynxZBjQKOfpomQ7yVNUsZh3eGnpczqSkSfCiUZuaqB9IUoo1OxlHkSVbCBkSvxXMGRIx7HIjPf10zJG2Yxt9_lbJNdgEqRRGdKLnDnNtlJ87M0T8HATKUJGCzmIBKdwp5zAUp2P6l5XtWLSLyK5zyfaWN2SQlIVqyNeeRbqvE6Om3SFIFQuuAVUDgqgF3VlOw7hFRs_ZuSO-v4aSoXvCythrcdEhmPz6O5zESn6Pa6GHgvyyiWSnhOWPLMGrnpgvX3YwcXYPcuwO5fgD3wN2PvBJuxh69txg7ZZuxdaL_rWJK-gOLtAuhI5_irwSl5a11IAAKGFgVApVSEvLkuc5bVrzolDmfO6jLtaDsle-si7deSzJXMFr3npEIL3_cvhB9cvBuycxH88GLXDrddQZ4JWc2FWnRkdAR5pviLtILavqAq5iJLx6oc5TdfJkpa3OHPfFlA-ZYFjwXWjtNWLmpQovuHzZnncjuv4fro8-fb6zJr3zFTV1MoND_SOKrkS-G21bWozR2h5LWOoVgKZ2ig74KzBc9F5sTNd_UYOifNX6a6PdfqFApr2xU23dGjQl8dnZtXWrEZb5veTlnBQxA4cybVTITkCu7U_RviJSsZy8w8y_1g98uP9esXzXPYz__9i19__r_9x2znCs7_um_WJySM1VJC4l7V5bUSnKlBPdxMUapPre-v3fF_RejPin84_OqXn31174MP__zF5__6ydtH9P8 \ No newline at end of file diff --git a/packages/solver/tests/gameExports/gen6_tidal_city49_server.txt b/packages/solver/tests/gameExports/gen6_tidal_city49_server.txt new file mode 100644 index 0000000..0c1db16 --- /dev/null +++ b/packages/solver/tests/gameExports/gen6_tidal_city49_server.txt @@ -0,0 +1 @@ +R2X1.jVlPjxxHFa_a6Z3q7mSdtWXLf9YbOxAlJ5DWdry5hnUcLNmy2Q1w4NCq7a7Zabanq6nutj0c4MpnCF-AE1K-AYIT3DlEiAMHxAUJRCTEATS8etXV_6Z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iMHbLN2IfQftexJH0JxdsF0JHO8VeDU_LOupAABAwtCoBKqQh5e11mltWvOyUOZ2Z1mXa0nZK9dZH2a0nmSmaL3nNSoYXv-xfCDy7eDdm5CH54sWuH264gnwlZzYVadGR0BPlM8ZdpBbV9QVXMRZaOVTnKb75MlLS4w5_5soDyLQseC6wdp61c1KBE9w-bM8_ldl7D9dHnzzfXZda-Y6auplBofqRxVMlXwm2ra1GbO0LJax1DsRTO0EDfBWcLnovMiZvv6jF0Tpq_SnV7rtUpFNa2K2y6o0eFvjo6N6-0Yme8bXo7ZQUPQeDMTKozEZIruFP3b4iXrGQsM_Ms9_PdL36sXz9vnsN-9O9f_Pqz_-0_frpzBed_3TfrExLGaikhca_r8loJztSgHm6mKNWn1vfX7vi_IvRnxT8cfvnLn31575Onf_78s399_90j8n8 \ No newline at end of file diff --git a/packages/solver/tests/gameExports/owner_editor_save.txt b/packages/solver/tests/gameExports/owner_editor_save.txt new file mode 100644 index 0000000..f9b0c25 --- /dev/null +++ b/packages/solver/tests/gameExports/owner_editor_save.txt @@ -0,0 +1 @@ +R2X1.jVnLj9y2GSclzWhmZ8feLBz4sXbsPJDkkAf83FyTtd0aqGFnN0iOglbi7DCrERVKsr35C4Lcc-2ph_wTAYr21GuAoAh66qW9FGgvBQK06JRPkZKoSTjCmvx-34vf9_Ebjjy--R773NxK6BmJcvSiLsG56Sc4Q5_FFaJi9isal-XkcVxEhyQ5fZlPHhKKyio6IDleIErq8oJFvY8SnNaMKGSekjydH8R59VGNs_TXiKIwISRDdH8nJWR1VMU0oihOKkK3F1n9Qi-2TlCOaMxmd830npnu7-aopiQ6oTjVMpNxzGbRTfjf9U_r7TlgIwyBHiEfcjqbzfkz5vP5XMxnM0mfs4cNnwOSPvM0wD5SggNcPeOSgLYxE-Tu8ANrIefS01vQA39f75zTfJ5D2D2szahNiKHR-fZcPlCt9dgWhBDqwUV8CJo1R5kXrbXwt1n7ktCGlUtdJxtpsdvb8J_rf6zPnQdt39VeGpKM-nz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PMPH8e09SGL2r4KCNVaZAAXNfIJ3jl2jsAV-6jgpS4Kh_lFeK_8W3wkgY7im8wzRoa1PzyQ4rQUYEYZoVlDq4_KjMTkp7gDQCuPTkuqzjJGLwiz-JMmtAMIbj8ZLHIcI4exDTnaTEYBNc-rnFyyrPhShQAewI_LNzoW3qhUz6wuyl4Uy8eJCQnq7MBxhnY04unBOdV2amRV9roozwh9l53wLt60VFDeKYcUb_MHflNfHx0iot2jbEy-hSniHyYqqR0wzqPj0uS1RWKvkSU-OACB_AzVEbH6IzkaVQxgQDsJkvKthzFSYIy-cImAOclMdevawDYYVCJ0mhByUpJznG-wDlmBvibHQjmxZKxRMdM5hRRCHa-qOO8qlcRepEs4_wEjcCuJlHEkpVwYz54jSqvo2OVpogx4VVcsRKOClZd1RhcczDRRPs3Btf7-DEmq7gstYY3HBxZnJxGS5Iho-hqn415T8ooIRS5YRJn2shlF8zfod3cgN3agN3egN2ZDGN3p8PYvdkwth8OYx-w9tvHUvyMHV4TQEc6u68PA_BqnwkxhBlaFQwqecm90uexXzuOXc4s6hKbsh2DvT5L814ydCWzQW85c93Atycb4TubpVl2NsH3NsP7ziCfIFItEV2ZYnQE-YTGz3DFzvaGU7FEGe6qchy_5VlKicYd_izPCnZ8yyJOkDo7Dlv9N8NOt_OafX2Y-hmD1_s8rG6SmrLKiYozGq9wClxNoeD1gZOoIs-R25ZpUcMdoYxrHkN0hpyhYX2XOVvEOcqceIVTHVpnmT_HvD3X9JgdrJErbLyjRwX_6jBu7jZsJ3HT9OZlxS5BzJkFoSfIB7tCkvdvFi9SkYRkW-Le9R388XP-73vqHva_56vfvv3O9w--ARfFOjqvb2vWf0Dwq9t_vvr31T_nf3v49dHqd8mjnz76Pw \ No newline at end of file diff --git a/packages/solver/tests/timeLab.test.ts b/packages/solver/tests/timeLab.test.ts new file mode 100644 index 0000000..4799be2 --- /dev/null +++ b/packages/solver/tests/timeLab.test.ts @@ -0,0 +1,105 @@ +/** + * The Time Lab table the planner prices a jump with. Hand-transcribed, so the + * tests are mostly that it agrees with itself, with the two other tables that + * carry part of it, and with what the game's own exports say a player owns. + */ +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { describe, expect, it } from "vitest"; +import { chrononAward, chrononMultiplier } from "../src/data/chronons"; +import { PRESTIGE_UPGRADES } from "../src/data/prestige"; +import { + chrononReactorGain, + TIME_LAB, + timeLabCost, + timeLabLevels, + timeLabResearch, +} from "../src/data/timeLab"; +import { decodeGameExport } from "../src/encoding/gameExport"; + +const DIR = join(dirname(fileURLToPath(import.meta.url)), "gameExports"); + +describe("TIME_LAB", () => { + it("has twelve researches, each priced level by level", () => { + expect(TIME_LAB).toHaveLength(12); + expect(new Set(TIME_LAB.map((r) => r.id)).size).toBe(12); + for (const r of TIME_LAB) { + expect(r.costs.length, r.id).toBeGreaterThan(0); + // Each level costs more than the one before it. + for (let i = 1; i < r.costs.length; i++) + expect(r.costs[i], `${r.id} ${i}`).toBeGreaterThan(r.costs[i - 1]); + if (r.kind === "level") expect(r.values).toBeNull(); + else expect(r.values!.length, r.id).toBe(r.costs.length); + } + }); + + it("agrees with the stat researches the solver rates buildings by", () => { + for (const upgrade of PRESTIGE_UPGRADES) { + expect(timeLabResearch(upgrade.id).values).toEqual(upgrade.bonuses); + } + }); + + it("agrees with the Chronon Reactor multiplier the award uses", () => { + const { values } = timeLabResearch("chronon_reactor"); + values!.forEach((bonus, i) => + expect(chrononMultiplier(i + 1)).toBeCloseTo(1 + bonus, 12), + ); + }); +}); + +describe("timeLabLevels", () => { + it("reads a player's levels off a game export, Chrono Seed included", async () => { + const exp = await decodeGameExport( + readFileSync(join(DIR, "gen2_city52_9c43e4b7_server.txt"), "utf8"), + ); + expect(timeLabLevels(exp.research)).toEqual({ + absolute_zero: 5, + archives_beyond_time: 8, + chrono_accelerator: 8, + chronon_reactor: 3, + erased_from_time: 5, + infinite_grid: 5, + phase_breaker: 6, + quantum_exchange: 5, + quantum_replicator: 6, + skip_city: 0, + stellar_forge: 10, + zero_time_protocol: 10, + }); + }); + + it("reads a research it is not told about as unbought, and clamps past the cap", () => { + const levels = timeLabLevels({ chronon_reactor: 99 }); + expect(levels.chronon_reactor).toBe(5); + expect(levels.stellar_forge).toBe(0); + }); +}); + +describe("timeLabCost", () => { + const reactor = timeLabResearch("chronon_reactor"); + + it("adds up the levels between", () => { + expect(timeLabCost(reactor, 0, 1)).toBe(150); + expect(timeLabCost(reactor, 3, 5)).toBe(1800 + 4000); + }); + + it("costs nothing going nowhere, and stops at the cap", () => { + expect(timeLabCost(reactor, 3, 3)).toBe(0); + expect(timeLabCost(reactor, 4, 2)).toBe(0); + expect(timeLabCost(reactor, 4, 9)).toBe(4000); + }); +}); + +describe("chrononReactorGain", () => { + it("is the extra award the higher multiplier pays at the same energy", () => { + const energy = 1.77717e31; + expect(chrononReactorGain(energy, 3, 4)).toBe( + chrononAward(energy, 1.2) - chrononAward(energy, 1.15), + ); + // About 4.3% more of an award near 11,140. + expect(chrononReactorGain(energy, 3, 4)).toBeGreaterThan(450); + expect(chrononReactorGain(energy, 3, 4)).toBeLessThan(500); + expect(chrononReactorGain(energy, 3, 3)).toBe(0); + }); +}); diff --git a/public/icons/icon_cash.webp b/public/icons/icon_cash.webp new file mode 100644 index 0000000..23d5142 Binary files /dev/null and b/public/icons/icon_cash.webp differ diff --git a/public/icons/icon_chronon.webp b/public/icons/icon_chronon.webp new file mode 100644 index 0000000..80e6ed4 Binary files /dev/null and b/public/icons/icon_chronon.webp differ diff --git a/public/icons/prestige_archives_beyond_time.webp b/public/icons/prestige_archives_beyond_time.webp new file mode 100644 index 0000000..2a0846c Binary files /dev/null and b/public/icons/prestige_archives_beyond_time.webp differ diff --git a/public/icons/prestige_chrono_accelerator.webp b/public/icons/prestige_chrono_accelerator.webp new file mode 100644 index 0000000..4b43dd5 Binary files /dev/null and b/public/icons/prestige_chrono_accelerator.webp differ diff --git a/public/icons/prestige_chronon_reactor.webp b/public/icons/prestige_chronon_reactor.webp new file mode 100644 index 0000000..73ef4cb Binary files /dev/null and b/public/icons/prestige_chronon_reactor.webp differ diff --git a/public/icons/prestige_erased_from_time.webp b/public/icons/prestige_erased_from_time.webp new file mode 100644 index 0000000..036ae3e Binary files /dev/null and b/public/icons/prestige_erased_from_time.webp differ diff --git a/public/icons/prestige_phase_breaker.webp b/public/icons/prestige_phase_breaker.webp new file mode 100644 index 0000000..faaa336 Binary files /dev/null and b/public/icons/prestige_phase_breaker.webp differ diff --git a/public/icons/prestige_quantum_exchange.webp b/public/icons/prestige_quantum_exchange.webp new file mode 100644 index 0000000..7ca3008 Binary files /dev/null and b/public/icons/prestige_quantum_exchange.webp differ diff --git a/public/icons/prestige_quantum_replicator.webp b/public/icons/prestige_quantum_replicator.webp new file mode 100644 index 0000000..c815e9a Binary files /dev/null and b/public/icons/prestige_quantum_replicator.webp differ diff --git a/public/icons/prestige_skip_city.webp b/public/icons/prestige_skip_city.webp new file mode 100644 index 0000000..ab1368f Binary files /dev/null and b/public/icons/prestige_skip_city.webp differ diff --git a/public/icons/prestige_zero_time_protocol.webp b/public/icons/prestige_zero_time_protocol.webp new file mode 100644 index 0000000..c9ef5d0 Binary files /dev/null and b/public/icons/prestige_zero_time_protocol.webp differ diff --git a/src/App.svelte b/src/App.svelte index de4d51f..c74b1a0 100755 --- a/src/App.svelte +++ b/src/App.svelte @@ -12,6 +12,7 @@ Header, ImportModal, HudToolbar, + MoveStepsBar, PixiCanvas, PreviewBanner, SettingsModal, @@ -19,6 +20,7 @@ ShareModal, SolveModal, SolveModeInfoModal, + TimeLabPlannerModal, UpgradePlanModal, } from "./lib/components"; import { Eye } from "lucide-svelte"; @@ -273,7 +275,15 @@ {#if !readOnly && !hudHidden} - + + {#if uiState.stepsActive || uiState.moveStepsPlanning} + + {:else} + + {/if} {/if} {/if} @@ -322,6 +332,7 @@ + + + {#if showSize} {/if} diff --git a/src/lib/components/header/TimelineStatus.svelte b/src/lib/components/header/TimelineStatus.svelte new file mode 100644 index 0000000..acc410f --- /dev/null +++ b/src/lib/components/header/TimelineStatus.svelte @@ -0,0 +1,737 @@ + + + +{#snippet energy()} + +{/snippet} + +{#snippet chronon()} + +{/snippet} + +{#if visible} + + +
+ {#if projection && record?.timeline} + +
+ Jump reward + + + {count(projection.award)} + + {#if bonusNames} + +88 if you enter {bonusNames} + {/if} + {#if projection.secondsToNext !== null} +
+ +
+ + Next in {formatSpan( + projection.secondsToNext, + )}{projection.chrononSeconds !== null + ? ` of ${formatSpan(projection.chrononSeconds)}` + : ""} + + {/if} + {#if pace} + + Earning {rate(pace.nowPerHour)}/h now · {rate( + pace.averagePerHour, + )}/h on average + + + {pace.nowPerHour < pace.averagePerHour + ? "Past the best point: a fresh timeline would earn faster" + : "Waiting still pays: you're above your average"} + + {/if} + {#if !projection.canJump} + + Jumping unlocks at {count(projection.threshold)} + + {/if} +
+ +
+
Power
+
+ {#if diverged && gamePower !== null} + game {formatNumber(gamePower)} + {/if} + {@render energy()} + {formatNumber(power)} +
+ {#if solvesGain !== null && withSolves !== null} +
With solves
+
+ +{solvesGain}% + {@render energy()} + {formatNumber(withSolves)} +
+ {/if} + +
Solves
+
+ {#if uiState.solveAll} + + solving {uiState.solveAll.done + 1} of {uiState.solveAll.total} + + {:else} + + {timelineState.solvedIslands} of {uiState.solveAllTargets.length} + islands + + {#if uiState.canSolveAll} + + {/if} + {/if} +
+ + {#if timelineState.planBudget !== null} +
Time Lab
+
+ {count(timelineState.planBudget)} to spend + +
+ {/if} +
Held
+
{@render chronon()}{count(record.timeline.chronons)}
+
Timeline
+
{formatSpan(projection.elapsedSeconds)}
+
+ + {#if eta} +
+ +
+ {#each quickTargets as value (value)} + + {/each} +
+ + {#if eta.seconds === null || eta.at === null} +

Never — nothing is producing

+ {:else if eta.seconds > OUT_OF_REACH_S} +

More than a year away at this power

+ {:else if eta.seconds > 0} +

+ In {formatSpan(eta.seconds)} + · {formatClockTime(eta.at, timelineState.now)} +

+ {#if eta.secondsWithSolves !== null} +

+ {formatSpan(eta.secondsWithSolves)} if the game ran your solves +

+ {/if} + {/if} +

+ You'd hold {count(eta.held)}{bonusNames + ? `, or ${count(eta.held + 88)} with the +88` + : ""} +

+
+ {/if} + +
+ + Exported {formatTimeAgo( + record.timeline.exportedAt * 1000, + timelineState.now, + )}{record.timeline.stampSource === "device" + ? ", game clock not synced" + : ""} + + +
+ {:else} + +
+
Power, all islands
+
{@render energy()}{formatNumber(power)}
+
+ {#if !record} + + {/if} + {/if} +
+{/if} + + diff --git a/src/lib/components/hud/MoveStepsBar.svelte b/src/lib/components/hud/MoveStepsBar.svelte new file mode 100644 index 0000000..f9590cb --- /dev/null +++ b/src/lib/components/hud/MoveStepsBar.svelte @@ -0,0 +1,525 @@ + + + + + +{#snippet cash()} + +{/snippet} + +
+
+ {#if planning || !m} +
+ + + Planning the steps{planning && planning.total + ? ` · ${Math.round((planning.done / planning.total) * 100)}%` + : "…"} + + +
+ {:else} +
+ + {index === 0 ? "Start" : `Step ${index} of ${total}`} + + + + {formatNumber(power)} + {#if before !== null && delta(power, before)} + {delta(power, before)} + {/if} + + +
+ +
+ {#if step} + {#if iconOf(step)} + + {/if} + {describe(step)} + {:else} + + Your board in Edit. {summary} to reach {formatNumber(end)}. + + {/if} +
+ + {#if index === total && m.plan.stoppedEarly} +

+ Done: this already makes the layout's power. The rest would only + rearrange buildings. +

+ {/if} + {#if price && (price.spend > 0 || price.refund > 0)} + +
+ {#if price.spend > 0} +
Costs
+
{@render cash()}{formatNumber(price.spend)}
+ {/if} + {#if price.refund > 0} +
Refunds
+
{@render cash()}{formatNumber(price.refund)}
+ {/if} +
+ {/if} + {#if index === 0 && money && (money.spend > 0 || money.refund > 0)} + +
+
Cash needed
+
{@render cash()}{formatNumber(money.spend)}
+
Refunded
+
{@render cash()}{formatNumber(money.refund)}
+ {#if money.peak > 0 && money.peak < money.spend} +
Cash on hand needed
+
{@render cash()}{formatNumber(money.peak)}
+ {/if} +
+ {/if} + {#if index === 0 && lowest < power} +

+ Lowest on the way: {formatNumber(lowest)}, {delta(lowest, power)} + from now. +

+ {/if} + + + {/if} +
+
+ + diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index 802b7ba..244cf58 100755 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -11,6 +11,7 @@ export { default as Header } from "./header/Header.svelte"; export { default as PreviewBanner } from "./header/PreviewBanner.svelte"; export { default as PixiCanvas } from "./canvas/PixiCanvas.svelte"; export { default as HudToolbar } from "./hud/HudToolbar.svelte"; +export { default as MoveStepsBar } from "./hud/MoveStepsBar.svelte"; export { default as BoardStatsCard } from "./inspector/BoardStatsCard.svelte"; export { default as ConfigSidebar } from "./sidebar/ConfigSidebar.svelte"; export { default as ShareModal } from "./modals/ShareModal.svelte"; @@ -19,3 +20,4 @@ export { default as SettingsModal } from "./modals/SettingsModal.svelte"; export { default as SolveModal } from "./modals/SolveModal.svelte"; export { default as SolveModeInfoModal } from "./modals/SolveModeInfoModal.svelte"; export { default as UpgradePlanModal } from "./modals/UpgradePlanModal.svelte"; +export { default as TimeLabPlannerModal } from "./modals/TimeLabPlannerModal.svelte"; diff --git a/src/lib/components/inspector/BoardStatsCard.svelte b/src/lib/components/inspector/BoardStatsCard.svelte index 15c0b7e..bc814e8 100755 --- a/src/lib/components/inspector/BoardStatsCard.svelte +++ b/src/lib/components/inspector/BoardStatsCard.svelte @@ -36,6 +36,7 @@ ChevronUp, Copy, Eye, + ListOrdered, Hammer, Loader2, RotateCcw, @@ -206,12 +207,17 @@ /* * The solve reports its own total rather than having it re-summed here: it * is the figure the search actually optimised, and `#scoreLayout` is what - * produced both it and the rows above. + * produced both it and the rows above. In step mode the board on screen is + * the island partway there, so the card reads that board's power instead — + * a card printing the finished solve over a half-built island is the + * mismatch `visiblePlacements` exists to prevent. */ let power = $derived( - panel === "solver" - ? (solverState.optimizationResult?.totalPower ?? 0) - : board.power, + uiState.stepsActive + ? uiState.visiblePower + : panel === "solver" + ? (solverState.optimizationResult?.totalPower ?? 0) + : board.power, ); /* @@ -593,11 +599,30 @@ > {#if runMode}{runMode.label}{/if} + + {#if uiState.solveAll}{uiState.solveAll.done + 1}/{uiState.solveAll.total}{/if} {solverState.isStopping ? "stopping" : countdown} {:else if panel === "solver" && !layoutState.isPreview} + + {#if uiState.canPlanMoveSteps && !uiState.stepsActive} + + {/if}
diff --git a/src/lib/components/modals/TimeLabPlannerModal.svelte b/src/lib/components/modals/TimeLabPlannerModal.svelte new file mode 100644 index 0000000..c088b5d --- /dev/null +++ b/src/lib/components/modals/TimeLabPlannerModal.svelte @@ -0,0 +1,425 @@ + + +{#if open && levels && budget !== null} + uiState.closeModal()}> +
+
+
To spend after the jump
+
+ + {count(budget)} +
+
Planned
+
{count(cost)}
+
Left
+
{count(budget - cost)}
+ {#if power && power.plan !== power.base} +
Plan's power
+
{pct(power.plan / power.base)}
+ {/if} +
+

+ {eta && eta.seconds + ? `Jumping at ${count(eta.target)}, the panel's target.` + : "Jumping now."} + {#if bonusNames} + + {/if} +

+
+ + {#each GROUPS as group (group.label)} +

{group.label}

+
    + {#each group.ids as id (id)} + {@const r = byId.get(id)!} + {@const now = levels[id]} + {@const extra = plan[id] ?? 0} + {@const max = r.costs.length} + {@const to = now + extra} + {@const note = to < max ? impact(r) : null} +
  • 0}> + +
    +
    + {r.name} + + Lv {now}{#if extra}{` → ${to}`}{/if}/{max} +
    +
    + {r.effect}: + {valueAt(r, now)}{#if extra}{" → "}{valueAt(r, to)}{/if} +
    + +
    +
    + {#if extra > 0} + + {/if} + {#if to < max} + + {/if} +
    +
  • + {/each} +
+ {/each} + + {#if cost > 0} + + {/if} +
+{/if} + + diff --git a/src/lib/components/sidebar/ConfigSidebar.svelte b/src/lib/components/sidebar/ConfigSidebar.svelte index 04d7c44..aa0c94c 100755 --- a/src/lib/components/sidebar/ConfigSidebar.svelte +++ b/src/lib/components/sidebar/ConfigSidebar.svelte @@ -1,9 +1,10 @@ + +{#if uiState.canSolveAll} + +{/if} + + diff --git a/src/lib/components/sidebar/TemplateSelector.svelte b/src/lib/components/sidebar/TemplateSelector.svelte index cf96725..60def17 100755 --- a/src/lib/components/sidebar/TemplateSelector.svelte +++ b/src/lib/components/sidebar/TemplateSelector.svelte @@ -5,10 +5,12 @@ layoutState, solverState, uiState, + viewportState, } from "../../state"; import { ISLAND_TEMPLATES, MAX_CUSTOM_ISLANDS } from "@reactor2/solver"; import type { IslandTemplate } from "../../types/building"; import { Plus, RotateCcw, Trash2 } from "lucide-svelte"; + import SolveAllButton from "./SolveAllButton.svelte"; import { onDestroy } from "svelte"; import { createConfirmArm } from "../confirmArm.svelte"; @@ -80,6 +82,14 @@
+ + {#if viewportState.isCompact} +
+ {/if} +