From 954bdfcdfc706a337d630d3bf9e6d7633393a619 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 23:56:12 -0500 Subject: [PATCH] =?UTF-8?q?game:=20pin=20all=2048=20=C2=A72.1=20starter=20?= =?UTF-8?q?pageIds=20from=20council-data=20(#28)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- shared/game/starter.ts | 55 +++++++++++++++++++++++++++++++++++--- tests/game-starter.test.ts | 5 ++-- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/shared/game/starter.ts b/shared/game/starter.ts index 8588e8c..5ba2d59 100644 --- a/shared/game/starter.ts +++ b/shared/game/starter.ts @@ -80,8 +80,57 @@ export function starterDeck(seed: number | string): GameCard[] { type Pin = [cost: number, title: string, faction: Faction, home: Stat]; -/** Real pageIds for the shared/catalog.ts cards; the others have none yet (§2.1), see loanerPageId. */ -const CATALOG_PAGE_IDS: Record = { Moon: 19331, 'Periodic table': 23053, Octopus: 22780, 'Albert Einstein': 736 }; +/** Real pageIds for every §2.1 starter card (council-data, docs/game/starter-cards.json `starterDeckPageIds`, #28). */ +const CATALOG_PAGE_IDS: Record = { + "Moon": 19331, + "Electron": 9476, + "Mars": 14640471, + "Periodic table": 23053, + "Saturn": 44474, + "Photosynthesis": 24544, + "Black hole": 4650, + "Quantum mechanics": 25202, + "Milky Way": 2589714, + "DNA": 7955, + "Sun": 26751, + "Theory of relativity": 30001, + "Octopus": 22780, + "Stonehenge": 27633, + "Axolotl": 235589, + "Rosetta Stone": 26428, + "Coral reef": 87410, + "Roman Empire": 25507, + "Honey bee": 58261, + "Ancient Egypt": 874, + "Amazon rainforest": 48139, + "Blue whale": 4925, + "Great Wall of China": 5094570, + "World War II": 32927, + "Haiku": 13217, + "Ada Lovelace": 974, + "Jazz": 15613, + "Marie Curie": 20408, + "Mona Lisa": 70889, + "Frida Kahlo": 162276, + "Chess": 5134, + "Leonardo da Vinci": 18079, + "The Beatles": 29812, + "William Shakespeare": 32897, + "Olympic Games": 22576, + "Wolfgang Amadeus Mozart": 33163, + "Sputnik 1": 28484, + "Nikola Tesla": 21473, + "Hubble Space Telescope": 40203, + "Isaac Newton": 14627, + "Neil Armstrong": 21247, + "Jupiter": 38930, + "Galileo Galilei": 29688374, + "Albert Einstein": 736, + "International Space Station": 15043, + "Apollo 11": 662, + "Charles Darwin": 8145410, + "Solar System": 26903, +}; export interface StarterDeckDef { id: string; name: string; cards: readonly Pin[] } @@ -115,7 +164,7 @@ export const STARTER_DECKS: readonly StarterDeckDef[] = [ const kebab = (title: string) => title.toLowerCase().normalize('NFKD').replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, ''); -/** §2.1: the real pageId for the shared/catalog.ts cards, null for the rest (copies then count per cardId). */ +/** §2.1: the card's real pageId; null only if council-data has none (copies then count per cardId). */ export function loanerPageId(title: string): number | null { return Object.hasOwn(CATALOG_PAGE_IDS, title) ? CATALOG_PAGE_IDS[title] : null; } diff --git a/tests/game-starter.test.ts b/tests/game-starter.test.ts index 36efdfd..f4ef7cb 100644 --- a/tests/game-starter.test.ts +++ b/tests/game-starter.test.ts @@ -30,12 +30,13 @@ test('starter cards follow §10.1 and the power curve like owned cards', () => { } }); -test('all 6 factions and all 4 shared/catalog.ts cards (with real pageIds) are covered', () => { +test('all 6 factions covered; every starter card has a real pageId, catalog ones as in shared/catalog.ts', () => { const all = STARTER_DECKS.flatMap(d => starterDeckById(d.id)); assert.equal(new Set(all.map(c => c.faction)).size, 6); const ids = Object.fromEntries(all.map(c => [c.title, c.pageId])); assert.deepEqual([ids.Moon, ids['Periodic table'], ids.Octopus, ids['Albert Einstein']], [19331, 23053, 22780, 736]); - for (const c of all) if (!['Moon', 'Periodic table', 'Octopus', 'Albert Einstein'].includes(c.title)) assert.equal(c.pageId, null, c.title); + for (const c of all) assert.ok(Number.isInteger(c.pageId) && c.pageId! > 0, `${c.title} has a real pageId`); + assert.equal(new Set(all.map(c => c.pageId)).size, all.length, 'no two starter cards share a pageId'); }); test('every starter deck passes engine deck validation and starts a match against every other', () => {