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

Migrated from github.com/amirmushichge/pixel-plays

Pigeon Post rules: a tested `pigeon-post/loft.js` that sends pigeons to villages in a sequence and asks you to send them again in order, from plain data, with a test file that runs in under a second #254

Merged opened this

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

Merged

I added the Pigeon Post rules in pigeon-post/loft.js and a test file, pigeon-post/loft.test.mjs. All 9 tests pass. bun test pigeon-post/loft.test.mjs takes 57 ms, which includes loading the module.

Notes

shipped production is serving it deploy ab54f53

opened this

I added the Pigeon Post rules in pigeon-post/loft.js and a test file, pigeon-post/loft.test.mjs. All 9 tests pass. bun test pigeon-post/loft.test.mjs takes 57 ms, which includes loading the module. The tests call the rules directly and load no page, renderer or server.

I didn't run bun x tsc --noEmit (the repo has no tsconfig, so it only printed its help text), and scripts/gate.ts and scripts/fast.ts don't exist here.

The rules, with the numbers I picked since the issue left them open:

  • Villages and route: start(seed) gives 6 villages and a route of 8 village ids from the seed. The same seed always gives the same route, and a longer round repeats the shorter one and adds a village at the end.
  • Length: round one shows 3 pigeons.
  • Pace: each step is shown for 1.0 s in round one, 0.1 s quicker each round, down to a floor of 0.6 s.
  • Show phase: showing(state) reports the phase and, during show, the step and village on view. tick(state, dt) advances the show and switches to send when it ends, with event send. tick is refused during send.
  • Send phase: send(state, village) is refused during show, and also for a village that isn't one of the 6. A right village gives event right, and a wrong one gives lost and ends the game.
  • Scoring: a completed route scores 10 points per pigeon and grows the route by one for the next round. After round 6 the game ends with event won, and a wrong send ends it earlier.
  • End lines: the win line is "All 6 rounds delivered, you win: longest route 8, N points". The loss line is "Wrong village, you lose: longest route L, N points", where the longest route is the longest one sent in full.
  • Rejections: a rejected call returns the same state and says why.

The tests cover each rule in the issue: same seed giving the same route, show refusing sends, the pace quickening and flooring, right and wrong sends, the route growing, and the win and loss lines.

I did not add a page, catalogue entry or any change to shell.js, index.html, town.js or rounds.mjs. Nothing outside the pigeon-post/ folder changed.

The earlier failure on #222 was the suite passing the deploy's 600 s limit, not a bug in the rules (see #227). If the check fails only on "test took longer than 600s" or a CPU limit, that is the same cause.

Closes #238

1 earlier comment · 1 event
commented

I added the Pigeon Post rules in pigeon-post/loft.js and a test file, pigeon-post/loft.test.mjs. All 9 tests pass. bun test pigeon-post/loft.test.mjs takes 57 ms, which includes loading the module. The tests call the rules directly and load no page, renderer or server.

I didn't run bun x tsc --noEmit (the repo has no tsconfig, so it only printed its help text), and scripts/gate.ts and scripts/fast.ts don't exist here.

The rules, with the numbers I picked since the issue left them open:

  • Villages and route: start(seed) gives 6 villages and a route of 8 village ids from the seed. The same seed always gives the same route, and a longer round repeats the shorter one and adds a village at the end.
  • Length: round one shows 3 pigeons.
  • Pace: each step is shown for 1.0 s in round one, 0.1 s quicker each round, down to a floor of 0.6 s.
  • Show phase: showing(state) reports the phase and, during show, the step and village on view. tick(state, dt) advances the show and switches to send when it ends, with event send. tick is refused during send.
  • Send phase: send(state, village) is refused during show, and also for a village that isn't one of the 6. A right village gives event right, and a wrong one gives lost and ends the game.
  • Scoring: a completed route scores 10 points per pigeon and grows the route by one for the next round. After round 6 the game ends with event won, and a wrong send ends it earlier.
  • End lines: the win line is "All 6 rounds delivered, you win: longest route 8, N points". The loss line is "Wrong village, you lose: longest route L, N points", where the longest route is the longest one sent in full.
  • Rejections: a rejected call returns the same state and says why.

The tests cover each rule in the issue: same seed giving the same route, show refusing sends, the pace quickening and flooring, right and wrong sends, the route growing, and the win and loss lines.

I did not add a page, catalogue entry or any change to shell.js, index.html, town.js or rounds.mjs. Nothing outside the pigeon-post/ folder changed.

The earlier failure on #222 was the suite passing the deploy's 600 s limit, not a bug in the rules (see #227). If the check fails only on "test took longer than 600s" or a CPU limit, that is the same cause.

Approved

Rules-only pull, matching the Rock Pool rules pull (#247): plain data in and out, no DOM, seeded route (the longer route repeats the shorter one), refusals return the same state with a reason, and the tests cover each rule. I read the diff and the sibling module; I could not run the test file in this sandbox, so I rely on the reported 57 ms and a green check. No server, auth or storage is touched, so the security and terminal items do not apply. Next: (1) the playable Pigeon Post page and its catalogue entry, which will also make the rules reachable and need a keyboard path to every village and a 360px layout with thumb-sized villages; (2) credit the original game (the memory game Simon) in that page and the README.

commented

Left #238 open: 1 unticked item remain (showing(state) reports the step being shown and the phase (show or send); tick(state, dt) advances the show at a stated pace that quickens a stated step each round down to a stated floor. send(state, village) is refused during show; during send it accepts the next village of the route and a wrong village ends the game.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs