Rules v0.8: rounds of alternating commands; sim updates
Rules (rules.md, new file): - Rounds of 2 commands per player in snake order (A B B A, then B A A B). A command is one advance or one attack; each Avatar acts once per round. - Flat 4 RAM captures, first row Lv 1, A2-C2 and C2-E2 lines cut, 45-card decks, Code Zero at 3 Cores with Patient Zero at 1+ counters. Simulator: - Command rule (default on): commands.perPlayer, commands.leads, commands.snake; commands.on=false restores whole turns. - Greedy bot values Avatar unlocks (unlockPoints) and picks one action per command. - Prototype switches, off by default: Avatars in the deck (recruit.*), buying Avatars (buyAvatars.*), copy limits (copies.*), turn-1 draw and second-player draw options. - cards.csv card-text revisions, with scripts and tests to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6382de19c9
commit
a3eb6850ee
21 changed files with 1089 additions and 96 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import type { CardDef, CardKind, CardPool } from './cards.ts';
|
||||
import { shuffle, type Rng } from './rng.ts';
|
||||
import type { RulesConfig } from './rules.ts';
|
||||
import { avatarsOutside, type RulesConfig } from './rules.ts';
|
||||
|
||||
export interface DeckList {
|
||||
avatars: string[];
|
||||
servers: string[];
|
||||
/** Executions, Hardware and Programs. */
|
||||
/** Executions, Hardware and Programs (and Avatars, when recruiting). */
|
||||
main: string[];
|
||||
}
|
||||
|
||||
|
|
@ -22,9 +22,9 @@ export function validateDeck(pool: CardPool, deck: DeckList, rules: RulesConfig)
|
|||
else if (!kinds.includes(card.kind)) errors.push(`${label}: "${name}" is a ${card.kind}`);
|
||||
}
|
||||
};
|
||||
part('Avatars', deck.avatars, ['avatar'], rules.deck.avatars);
|
||||
part('Avatars', deck.avatars, ['avatar'], avatarsOutside(rules));
|
||||
part('Servers', deck.servers, ['server'], rules.deck.servers);
|
||||
part('Deck', deck.main, MAIN_KINDS, rules.deck.main);
|
||||
part('Deck', deck.main, rules.recruit.on ? [...MAIN_KINDS, 'avatar'] : MAIN_KINDS, rules.deck.main);
|
||||
const copies = new Map<string, number>();
|
||||
for (const name of [...deck.avatars, ...deck.servers, ...deck.main]) {
|
||||
copies.set(name, (copies.get(name) ?? 0) + 1);
|
||||
|
|
@ -49,6 +49,12 @@ export function randomDeck(
|
|||
if (names.length < size) throw new Error(`Not enough ${kinds.join('/')} cards for a deck`);
|
||||
return shuffle(rng, names).slice(0, size);
|
||||
};
|
||||
if (rules.recruit.on) {
|
||||
const k = rules.recruit.avatarsInDeck;
|
||||
const avatars = sample(['avatar'], 1 + k);
|
||||
const servers = sample(['server'], rules.deck.servers);
|
||||
return { avatars: avatars.slice(0, 1), servers, main: shuffle(rng, [...avatars.slice(1), ...sample(MAIN_KINDS, rules.deck.main - k)]) };
|
||||
}
|
||||
return {
|
||||
avatars: sample(['avatar'], rules.deck.avatars),
|
||||
servers: sample(['server'], rules.deck.servers),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue