v1.11.1: choose how core counts are written - #19
Merged
Conversation
Legacy Cores were the last number still printed in full. By the mid game that is nineteen digits in a row sized for a phone, and the Migrate button carries a second one beside it - the two numbers a player looks at most often were the two least readable in the game. fmtCores(n, format) offers three renderings. 'full' is the historical one and stays the default, so an untouched save reads exactly as it did before the setting existed. 'letters' walks A..Z then AA, AB - bijective base-26, one letter per power of a thousand, so it cannot run out the way the fixed K/M/G ladder in fmt() does at 10^33. 'scientific' is toExponential(2), matching the shape the Compute Balance readout already falls back to. Both compact modes stay literal below a thousand: "50 cores" reads better than "5.00e+1 cores", and there is nothing to abbreviate down there anyway. The preference is client-side (localStorage), not canonical state - nothing in the simulation reads it, so there is no migration and no server round trip. It lives in a module-level useSyncExternalStore rather than component state because the header chip, the Migrate button, the Singularity panel and the Settings picker all render it and cycling from the chip has to move all of them at once; the alternative was threading a prop through RackStack.jsx to five places. Storage access is try/caught - a private-mode browser falls back to the default instead of taking the header down with a SecurityError. The header chip is now a button that cycles the setting in place, since the number itself is what a player is looking at when they want it changed. The same choice is in Profile > Settings for anyone who would rather pick it explicitly, previewing against their own core count. Applied to every core readout, not just the header: the chip, the Migrate payout, the Singularity panel and its confirmation, Profile stats, and the Legacy Cores leaderboard. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Patch rather than minor: v1.12.0 is already claimed by the open Economy Rebalance PR (#18), and stealing the number would leave that branch with nowhere to land. package-lock.json's version field had been stale since v1.7.0 - `npm install` resynced it to 1.11.1 as a side effect, and that correction rides along here rather than as its own commit. Verified: SQLite 2261 passing across 147 files, client builds, and the three formats render as expected through StatsRow, MigrateBar and the Settings picker. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Legacy Cores were the last number in the game still printed in full — nineteen digits by the mid game, in a row sized for a phone, with a second one on the Migrate button beside it.
Profile → Settings now offers three renderings, and the header chip itself is a button that cycles them in place:
4087353084334554000 cores+124626540980725780 cores4.09F cores+125E cores4.09e+18 cores+1.25e+17 coresABC is bijective base-26 — one letter per power of a thousand, A…Z then AA, AB — so unlike the fixed K/M/G ladder in
fmt()it never runs out. Both compact modes stay literal below a thousand, because "50 cores" reads better than "5.00e+1 cores".Applied to every core readout: the chip, the Migrate payout, the Singularity panel and its confirmation, Profile stats, and the Legacy Cores leaderboard. Default stays
full, so an untouched save reads exactly as it did before.The preference is client-side (
localStorage), not canonical state — nothing in the simulation reads it, so there's no migration and no server round trip. It lives in a module-leveluseSyncExternalStoreso the chip, Migrate button, Singularity panel and Settings picker all move together when the chip is tapped.Versioning: patch, not minor — v1.12.0 is claimed by #18.
Verification
tests/coreFormat.test.js— 13 new tests: the three formats, the A→Z→AA rollover, negatives/∞, cycling, normalization of unrecognized input.client && npm run buildclean.StatsRow,MigrateBarandProfileSettingsviareact-dom/serverto confirm the strings in the table above.🤖 Generated with Claude Code