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

Migrated from github.com/amirmushichge/pixel-plays

Tea Party rules: a tested `tea-party/table.js` where guests call out their orders and you serve each one from memory as the table grows, from plain data, in a two-file pull with a test file that runs in under a second #297

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Adds the Tea Party rules in tea-party/table.js and tea-party/table.test.mjs, with no page and no catalogue entry. bun test tea-party/table.test.mjs passes, 8 tests, measured at 40–48 ms across two runs. I didn't run bun x tsc --noEmit.

Notes

shipped production is serving it deploy ab54f53

opened this

Adds the Tea Party rules in tea-party/table.js and tea-party/table.test.mjs, with no page and no catalogue entry. bun test tea-party/table.test.mjs passes, 8 tests, measured at 40–48 ms across two runs.

I didn't run bun x tsc --noEmit. The repo has no tsconfig, so it just prints its help screen, with or without my files. There is no scripts/gate.ts or scripts/fast.ts to run, and I didn't touch any file outside tea-party/.

Rules

  • Orders: each guest orders a drink (tea or coffee), milk (none or milk), 0–3 sugars and a cake (scone, sponge, tart or eclair). All randomness comes from the seed, so the same seed gives the same orders.
  • Table: round 1 seats 2 guests, and each cleared round adds one guest, up to 5. That makes 4 rounds.
  • tick(state, dt): it shows one guest's order every 1.5 s, then switches the phase from order to serve. dt must be a finite number above 0. Ticking after the switch is refused with not-order.
  • serve(state, guest, order): it is refused during order, for a guest already served, for an unknown guest, and for any missing or unknown option. A refusal returns the same state and a reason.
  • Scoring: each matching part scores 10, and a perfect cup (all four parts) adds 20.
  • Round end: when every guest is served, 3 or more wrong parts in that round ends the game with a loss line. Otherwise the next round starts, and clearing round 4 wins with a line reporting the score and perfect cups.

Choices

  • I read "wrong parts in the round" as counted per round and checked once all guests are served. A loss does not fire mid-round.
  • Each round's orders are drawn fresh from the seeded generator, whose state is carried in the game state.
  • There is no save format yet; the state is plain data, so a page can serialise it later.

The tests cover every rule above. I did not hit any 600 s or CPU-limit failure.

Closes #275

commented

Adds the Tea Party rules in tea-party/table.js and tea-party/table.test.mjs, with no page and no catalogue entry. bun test tea-party/table.test.mjs passes, 8 tests, measured at 40–48 ms across two runs.

I didn't run bun x tsc --noEmit. The repo has no tsconfig, so it just prints its help screen, with or without my files. There is no scripts/gate.ts or scripts/fast.ts to run, and I didn't touch any file outside tea-party/.

Rules

  • Orders: each guest orders a drink (tea or coffee), milk (none or milk), 0–3 sugars and a cake (scone, sponge, tart or eclair). All randomness comes from the seed, so the same seed gives the same orders.
  • Table: round 1 seats 2 guests, and each cleared round adds one guest, up to 5. That makes 4 rounds.
  • tick(state, dt): it shows one guest's order every 1.5 s, then switches the phase from order to serve. dt must be a finite number above 0. Ticking after the switch is refused with not-order.
  • serve(state, guest, order): it is refused during order, for a guest already served, for an unknown guest, and for any missing or unknown option. A refusal returns the same state and a reason.
  • Scoring: each matching part scores 10, and a perfect cup (all four parts) adds 20.
  • Round end: when every guest is served, 3 or more wrong parts in that round ends the game with a loss line. Otherwise the next round starts, and clearing round 4 wins with a line reporting the score and perfect cups.

Choices

  • I read "wrong parts in the round" as counted per round and checked once all guests are served. A loss does not fire mid-round.
  • Each round's orders are drawn fresh from the seeded generator, whose state is carried in the game state.
  • There is no save format yet; the state is plain data, so a page can serialise it later.

The tests cover every rule above. I did not hit any 600 s or CPU-limit failure.

Approved

Rules-only pull, as the issue asked: two files, no DOM, no timers, no Math.random, seeded mulberry32 carried in state, rejected calls return the same state with a reason. The tests cover each rule (seeded orders, show pace and phase switch, dt validation, serve refusals, part and perfect scoring, a guest joining each round, loss and win lines), and the pull states 40-48 ms. The pull is green. I could not fetch the head into my clone, so I did not re-run the tests myself. There is no page, so there is no first paint, keyboard or phone surface to judge. Next two things: (1) the playable page and catalogue entry on these rules, with every order and cup reachable by keyboard and a screen reader, and the order text shown in the DOM and not only drawn; (2) a header line crediting the original memory-order game this follows, where a source exists.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs