forked from WikiDeck/wikideck
game: export RULESET_V1_0 (frozen) and pin the §12 golden test to it; DEFAULT_RULESET = current version
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/** Public entry point of the WikiDeck game engine. Other teams import only from here. See docs/game/ENGINE_API.md. */
|
/** 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 * from './types.ts';
|
||||||
export { Rng, seedFromString, normalizeSeed, type RngState } from './rng.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 {
|
export {
|
||||||
ENGINE_VERSION, createMatch, legalActions, applyAction, actionProblem, isOver, result, viewFor,
|
ENGINE_VERSION, createMatch, legalActions, applyAction, actionProblem, isOver, result, viewFor,
|
||||||
serialize, deserialize, replay, validateDeck, cardPower, lanePower, laneLeader, laneCapacity, scoringPower, topicsLed, other, placeCard, revealPortal,
|
serialize, deserialize, replay, validateDeck, cardPower, lanePower, laneLeader, laneCapacity, scoringPower, topicsLed, other, placeCard, revealPortal,
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ export const DEFAULT_TOPIC_POOL: Ruleset['topicPool'] = [
|
|||||||
{ id: 'disambiguation', name: 'Disambiguation', stat: 'reach', portal: 'disambiguation' },
|
{ id: 'disambiguation', name: 'Disambiguation', stat: 'reach', portal: 'disambiguation' },
|
||||||
];
|
];
|
||||||
|
|
||||||
/** DESIGN §9 defaults (v1). */
|
/** DESIGN §9 v1.0 rules, frozen: the §12 golden match is pinned to these. */
|
||||||
export const DEFAULT_RULESET: Ruleset = {
|
export const RULESET_V1_0: Ruleset = {
|
||||||
version: '1.0',
|
version: '1.0',
|
||||||
deckSize: 12, maxCopiesPerPage: 2, maxLoaners: 12,
|
deckSize: 12, maxCopiesPerPage: 2, maxLoaners: 12,
|
||||||
openingHand: 3, handLimit: 7, mulligan: false,
|
openingHand: 3, handLimit: 7, mulligan: false,
|
||||||
@@ -126,3 +126,6 @@ export const DEFAULT_RULESET: Ruleset = {
|
|||||||
percentiles: 'card-sample-2026-11-16',
|
percentiles: 'card-sample-2026-11-16',
|
||||||
starterDecks: 'default',
|
starterDecks: 'default',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** DESIGN §9 defaults: the current rules version. */
|
||||||
|
export const DEFAULT_RULESET: Ruleset = RULESET_V1_0;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {
|
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,
|
type Action, type GameCard, type MatchState, type PlayerId, type Ruleset, type Stat, type Faction,
|
||||||
} from '../shared/game/index.ts';
|
} from '../shared/game/index.ts';
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ const PLAN: [PlayerId, string, number][][] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function setup(): MatchState {
|
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 state = createMatch(rules, [starterDeck('golden-a'), starterDeck('golden-b')], 1);
|
||||||
const pool = state.ruleset.topicPool;
|
const pool = state.ruleset.topicPool;
|
||||||
const find = (id: string) => pool.find(t => t.id === id) ?? assert.fail(`topic ${id} missing from the default pool`);
|
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 });
|
return applyAction(state, { type: 'commit', player: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
test('§12 golden: rules defaults match the frozen §9 values', opts, () => {
|
test('§12 golden: RULESET_V1_0 matches the frozen §9 v1.0 values', opts, () => {
|
||||||
for (const [key, value] of Object.entries(FROZEN)) assert.deepEqual((DEFAULT_RULESET as unknown as Record<string, unknown>)[key], value, key);
|
for (const [key, value] of Object.entries(FROZEN)) assert.deepEqual((RULESET_V1_0 as unknown as Record<string, unknown>)[key], value, key);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('§12 golden: final Topic powers 19–15, 15–19, 13–10; Ana (p0) wins 2–1', opts, () => {
|
test('§12 golden: final Topic powers 19–15, 15–19, 13–10; Ana (p0) wins 2–1', opts, () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user