Public: anyone can read this; the crew can change it.

The deal: a charter and four secret charges from a seed, in src/board.ts #6

shipped production is serving it opened this has it
opened this

Intent. One pure module that turns a seed and a player count into a table's public charter and its secret charges, so a game is reproducible, testable and never needs a random number at read time.

Done looks like

  • [ ] src/board.ts exports deal(seed: string, players: number): { clauses: Clause[]; charges: Charge[] } — plain data in, plain data out, no database and no clock.
  • [ ] A fixed pool of at least 10 clauses, each with exactly 3 settings, with names that read like a wreck being argued over; deal draws 7 of them.
  • [ ] A charge is 4 aims on 4 distinct clauses: three positive with weights 1, 2, 3 or 5, plus one dread of −3. Aims are distinct per seat; no two seats get the same charge.
  • [ ] The deal guarantees tension, and a test proves it: at least two seats hold aims that cannot both be satisfied (same clause, different settings), and no single accord satisfies every seat's positive aims.
  • [ ] score(charge, accord) lives here too: the sum of satisfied positive aims, minus 3 when the dread's setting is the one chosen. Tested against a hand-worked example from RULES.md.
  • [ ] Randomness is a small seeded PRNG written here (no dependency); the same seed and count give byte-identical output, and a test asserts it against a recorded fixture.
  • [ ] players outside 4–6 and an empty seed are refused at the boundary with a named failure, not an exception.

Files src/board.ts (new), src/board.test.ts (new).

Risks A generator that produces a board with an obvious dominant accord makes for a dull game — assert against it. Keep deal free of Date.now() and Math.random() so tests stay deterministic.

Brief that fits @torque — exact, deterministic, and tested against a hand calculation. (A person assigns.)

commented

Amended by the planner, now that RULES.md is merged (#17) and is the rules of record. Two bullets in this body are looser than the rules: take the rules.

  • The three positive weights of a charge are distinct — three distinct values drawn from {1, 2, 3, 5}, so a charge's positives total 6, 8, 9 or 10 and the score range is −3…10 (§2). deal asserts it and a test proves no charge repeats a weight. The body's "weights 1, 2, 3 or 5" is the older, looser wording.
  • The clause pool and the ids are already written — §3 names 12 clauses with the exact clause and setting ids to store, and §10 is a hand-checkable four-seat example with the scores (8/6/4/8) score() must reproduce. Use those ids and that example rather than inventing a pool; if a clause in §3 reads badly to you, change RULES.md in the same pull and say why.

Everything else in the body stands.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs