Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Add Bell Tower: ring the peal back on four bells, one bell longer each round #69
Check · Review · Land · Live done — Landed and live in production.
Bell Tower is added at /bell-tower/. The new peal tests, serve.test.mjs and the four Bell Tower playtests pass. I haven't run the full suite; the forge runs it on push.
shipped production is serving it deploy ab54f53
3 earlier comments · 1 event
Bell Tower is added at /bell-tower/. The new peal tests, serve.test.mjs and the four Bell Tower playtests pass. I haven't run the full suite; the forge runs it on push. I also played one peal through the page in the playtest harness: the score went to 3 and the HUD updated.
What changed
- Rules in
bell-tower/peal.js: it holds all the rules as plain data in and out, with no DOM.
- A seeded peal, so the same seed gives the same peal. - The next peal is the last one plus one bell, starting at three. - A right peal of length n scores n. - A wrong bell ends that peal with a miss, and the same peal plays again. - The third miss ends the game. - A bell stays locked for 0.5 s after it rings.
- Tests in
bell-tower/peal.test.mjs: 13 tests cover each of those rules plus bad input. - Page: it is built on the engine in the same shape as Tightrope. The tower is an open stone floor with four pillars and four bells in different metals, smallest to largest. A ringer moves to the rope that was pulled, pigeons sit on the back parapet, and 1–4 are painted under the ropes.
- Input: a tap hits one of four equal columns, so each target is about 90 px wide, which suits a phone. Keys are 1–4, or the arrows left, down, up, right in the order the bells hang. The aria-label says how to play and the rules popup is four lines.
- Sound and motion: bell notes are Web Audio with four partials each and no files. A bell flashes while it swings whether or not sound is on. Pigeon motion stops under
prefers-reduced-motion, and the bell swing shrinks to a small angle there. - Listings:
shell.jsGAMES, the rootindex.html<li>, the README Games table and the README no-music list. The README'sshell.jskinds comment and the allowed-kinds list inserve.test.mjsnow includeMemory. The home kind filter builds itself fromGAMES, so it needed no change.bun scripts/og.mjswas run, soog/bell-tower.png,og/home.pngand the share tags are updated. No.mp3is committed.
Decisions to review
- Too-fast pulls: the issue says ringing too fast is a miss, but its test list says pulling a swinging bell is ignored. I followed the test list. A rushed pull does nothing except show "wait for that bell to swing back", and only a wrong bell counts as a miss.
- Bell shape: the bells still look a little like gourds, because the engine's round capsules can't give a flat lip. I stopped there.
- No time limit: there is no timeout on the player's turn.
- Not done:
scripts/design-lint.tsdoesn't exist in this repo, so I didn't run it. Thetsccheck only printed its help text because there is notsconfig.
Try it: bun serve.mjs, open /bell-tower/, listen to the peal, then ring it back with 1–4 or by tapping the ropes.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. It should merge cleanly now.
README.md: the only conflict was the list of games without music. I keptmain's line, which now includes Tram Line, and added Bell Tower: "Tightrope, Tram Line and Bell Tower".og/home.png: I tookmain's version and re-ranbun scripts/og.mjs. That regenerated the home card with both new games, and the Bell Tower card is unchanged.- Tests:
serve.test.mjs,shell.test.mjsandbell-towerpass, 57 in all. I did not re-run the playtests or the rest of the suite after the merge.
The Bell Tower change itself is as described in the earlier pull description.
The rules module is clean and well tested: 13 peal tests, serve/shell and the four bell-tower playtests pass locally against this head (57 + 4). The preview answers on /, /bell-tower/, peal.js and the card, and the four bells sit exactly at the centres of the four tap columns (x = 45/135/225/315 on the 360 canvas). Following the test list over the issue's "too fast is a miss" line is the right call, and the pull says so.
One thing to fix, and it's a miss on the issue's HUD line ("the HUD shows score, peal length …"):
The HUD's peal length is one round behind. renderHud() runs only on peal, miss and over, but seq only grows in advance when the listen event fires. So after a right peal the tower rings 4 bells while the HUD still says 3. I drove the page through playtest.mjs and tapped each right rope: at the player's turn, seq/HUD read 4/3, then 5/4, then 6/5. The status line ("your turn · 4 bells") disagrees with the HUD next to it.
Fix: call renderHud() on the listen event in act() (bell-tower/index.html:261). Add a page-level test that would fail without it. For example, in a bell-tower/page.test.mjs using boot('bell-tower') from playtest.mjs: ring the first peal back by tapping the rope columns, run until the next turn, and expect el('length').textContent to be '4'. Nothing else is needed: no tty exists in this static app, no server code changed, and the attribution as "forged by the crew" is consistent with the other forged games.
The HUD peal length now updates when the tower starts a longer peal, so it no longer lags a round behind. You were right about the cause. seq grows in Peal.advance, but the HUD was only redrawn on peal, miss and over.
- Fix: the
listenhandler inact()(bell-tower/index.html:261) now callsrenderHud()after the status note, as you suggested. - Test:
bell-tower/page.test.mjsboots the page withboot('bell-tower'). It waits for the first turn and checks#lengthreads 3. It then taps the rope columns at x = 45, 135, 225 and 315 to ring the peal back, and checks#scorereads 3. After the next turn starts it checks#lengthreads 4. - Check: with the
index.htmlchange stashed, the new test fails withExpected: "4",Received: "3". With the fix, all 14 bell-tower tests pass. I did not re-run the rest of the suite.
I'm not disputing any of your other points.
I merged main into the branch again and pushed it; it should merge cleanly now.
README.md: the conflict was the list of games without music again. I tookmain's line, which now ends "Tram Line and Archery", and made it "Tram Line, Archery and Bell Tower". The Bell Tower row in the Games table is still there.og/home.png: I tookmain's image and re-ranbun scripts/og.mjs, so the home card is regenerated.- Tests:
serve.test.mjs,shell.test.mjsandbell-towerpass, 59 in all, including the peal tests and the page test. I did not re-run the playtests for the other games or the rest of the suite.
My earlier ask was that the HUD peal length lag a round behind. That is met: the listen handler in act() now calls renderHud(), and bell-tower/page.test.mjs checks #length goes 3 to 4 and fails without the fix. The preview serves /bell-tower/ (200). I read the diff as it stands in the PR and could not diff against 8a0b8603cb93 because that commit is not in the clone. The rules module is pure and tested, the game is listed in shell.js, the home page and the README, and the share card is regenerated. Non-blocking: the bells look a little like gourds, as the author said.
Bell Tower is added at
/bell-tower/. The new peal tests,serve.test.mjsand the four Bell Tower playtests pass. I haven't run the full suite; the forge runs it on push. I also played one peal through the page in the playtest harness: the score went to 3 and the HUD updated.What changed
bell-tower/peal.js: it holds all the rules as plain data in and out, with no DOM.- A seeded peal, so the same seed gives the same peal. - The next peal is the last one plus one bell, starting at three. - A right peal of length n scores n. - A wrong bell ends that peal with a miss, and the same peal plays again. - The third miss ends the game. - A bell stays locked for 0.5 s after it rings.
bell-tower/peal.test.mjs: 13 tests cover each of those rules plus bad input.prefers-reduced-motion, and the bell swing shrinks to a small angle there.shell.jsGAMES, the rootindex.html<li>, the README Games table and the README no-music list. The README'sshell.jskinds comment and the allowed-kinds list inserve.test.mjsnow includeMemory. The home kind filter builds itself fromGAMES, so it needed no change.bun scripts/og.mjswas run, soog/bell-tower.png,og/home.pngand the share tags are updated. No.mp3is committed.Decisions to review
scripts/design-lint.tsdoesn't exist in this repo, so I didn't run it. Thetsccheck only printed its help text because there is notsconfig.Try it:
bun serve.mjs, open/bell-tower/, listen to the peal, then ring it back with 1–4 or by tapping the ropes.🤖 Generated with Claude Code
Closes #59