diff --git a/shared/game/index.ts b/shared/game/index.ts index 3f781b1..bf8e836 100644 --- a/shared/game/index.ts +++ b/shared/game/index.ts @@ -1,7 +1,7 @@ /** Public entry point of the WikiDeck game engine. Other teams import only from here. See docs/game/ENGINE_API.md. */ export * from './types.ts'; export { Rng, seedFromString, normalizeSeed, type RngState } from './rng.ts'; -export { DEFAULT_RULESET, DEFAULT_TOPIC_POOL, RulesetSchema, TopicSchema, parseRuleset } from './ruleset.ts'; +export { DEFAULT_RULESET, RULESET_V1_0, DEFAULT_TOPIC_POOL, RulesetSchema, TopicSchema, parseRuleset } from './ruleset.ts'; export { ENGINE_VERSION, createMatch, legalActions, applyAction, actionProblem, isOver, result, viewFor, serialize, deserialize, replay, validateDeck, cardPower, lanePower, laneLeader, laneCapacity, scoringPower, topicsLed, other, placeCard, revealPortal, diff --git a/shared/game/ruleset.ts b/shared/game/ruleset.ts index 6975219..c48b1d0 100644 --- a/shared/game/ruleset.ts +++ b/shared/game/ruleset.ts @@ -97,8 +97,8 @@ export const DEFAULT_TOPIC_POOL: Ruleset['topicPool'] = [ { id: 'disambiguation', name: 'Disambiguation', stat: 'reach', portal: 'disambiguation' }, ]; -/** DESIGN §9 defaults (v1). */ -export const DEFAULT_RULESET: Ruleset = { +/** DESIGN §9 v1.0 rules, frozen: the §12 golden match is pinned to these. */ +export const RULESET_V1_0: Ruleset = { version: '1.0', deckSize: 12, maxCopiesPerPage: 2, maxLoaners: 12, openingHand: 3, handLimit: 7, mulligan: false, @@ -126,3 +126,6 @@ export const DEFAULT_RULESET: Ruleset = { percentiles: 'card-sample-2026-11-16', starterDecks: 'default', }; + +/** DESIGN §9 defaults: the current rules version. */ +export const DEFAULT_RULESET: Ruleset = RULESET_V1_0; diff --git a/tests/game-golden.test.ts b/tests/game-golden.test.ts index af3981a..3d80462 100644 --- a/tests/game-golden.test.ts +++ b/tests/game-golden.test.ts @@ -8,7 +8,7 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import { - DEFAULT_RULESET, applyAction, createMatch, isOver, lanePower, result, starterDeck, topicsLed, + RULESET_V1_0, applyAction, createMatch, isOver, lanePower, result, starterDeck, topicsLed, type Action, type GameCard, type MatchState, type PlayerId, type Ruleset, type Stat, type Faction, } from '../shared/game/index.ts'; @@ -55,7 +55,7 @@ const PLAN: [PlayerId, string, number][][] = [ ]; function setup(): MatchState { - const rules: Ruleset = { ...DEFAULT_RULESET }; + const rules: Ruleset = structuredClone(RULESET_V1_0); // §12 is pinned to the v1.0 ruleset const state = createMatch(rules, [starterDeck('golden-a'), starterDeck('golden-b')], 1); const pool = state.ruleset.topicPool; const find = (id: string) => pool.find(t => t.id === id) ?? assert.fail(`topic ${id} missing from the default pool`); @@ -77,8 +77,8 @@ function playTurn(state: MatchState, plays: [PlayerId, string, number][]): Match return applyAction(state, { type: 'commit', player: 1 }); } -test('§12 golden: rules defaults match the frozen §9 values', opts, () => { - for (const [key, value] of Object.entries(FROZEN)) assert.deepEqual((DEFAULT_RULESET as unknown as Record)[key], value, key); +test('§12 golden: RULESET_V1_0 matches the frozen §9 v1.0 values', opts, () => { + for (const [key, value] of Object.entries(FROZEN)) assert.deepEqual((RULESET_V1_0 as unknown as Record)[key], value, key); }); test('§12 golden: final Topic powers 19–15, 15–19, 13–10; Ana (p0) wins 2–1', opts, () => {