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

Migrated from github.com/amirmushichge/pixel-plays

Add Coconut Shy: the playable page and its place in the catalogue, on the rules already in `coconut-shy/shy.js` #126

Merged opened this

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

Merged

Coconut Shy is now a playable page at /coconut-shy/ and is listed in the catalogue. It is built only on coconut-shy/shy.js and adds no game rule of its own. Checks coconut-shy tests, shell.test.mjs, serve.test.mjs (52 tests) and the coconut-shy playtests all pass.

Notes

shipped production is serving it deploy ab54f53

opened this

Coconut Shy is now a playable page at /coconut-shy/ and is listed in the catalogue. It is built only on coconut-shy/shy.js and adds no game rule of its own.

Checks

  • coconut-shy tests, shell.test.mjs, serve.test.mjs (52 tests) and the coconut-shy playtests all pass.
  • I did not run the full bun test; the forge runs it on the push.
  • bun x tsc --noEmit only printed its help text, so it checked nothing here. There is no tsconfig in the repo.
  • Branch was already up to date with origin/main when I pushed, so there were no conflicts in shell.js, index.html or the README.

Play

  • Drag back on the canvas and release to throw. Drag length sets power, and dragging down lobs higher.
  • From the keyboard, Left/Right (or Up/Down) change the angle one degree, Space is held for power and released to throw, and Enter works as Space.
  • The ball flies, and the HUD and coconuts only update when it lands, from the state shy.js returns.
  • Between rounds the HUD says what comes next, and after the game it shows the rules' win or loss line with a "play again" prompt.
  • Ambient motion is only the bunting and the stallholder, and it stops under reduced motion. The thrown ball and wobbling coconuts are play, not ambience.

Files and wiring

  • GAMES entry, root <li>, README table row and the no-music README list are in as specified.
  • bun scripts/og.mjs was run, so og/coconut-shy.png, the page's share tags and og/home.png are updated.
  • The serve.test.mjs assertion, rounds.mjs scripted round and coconut-shy/page.test.mjs are added.
  • The scripted round reaches "You win with 18 down!" in a run of its own.

Chosen not to do

  • No aim-preview of the landing spot; only a short dotted launch arrow, so the game stays about judging distance.
  • No music, per the issue.

To try it

  • Open /coconut-shy/ on the preview.

I touched no other game.

🤖 Generated with Claude Code

Closes #106

4 earlier comments · 2 events
commented

Coconut Shy is now a playable page at /coconut-shy/ and is listed in the catalogue. It is built only on coconut-shy/shy.js and adds no game rule of its own.

Checks

  • coconut-shy tests, shell.test.mjs, serve.test.mjs (52 tests) and the coconut-shy playtests all pass.
  • I did not run the full bun test; the forge runs it on the push.
  • bun x tsc --noEmit only printed its help text, so it checked nothing here. There is no tsconfig in the repo.
  • Branch was already up to date with origin/main when I pushed, so there were no conflicts in shell.js, index.html or the README.

Play

  • Drag back on the canvas and release to throw. Drag length sets power, and dragging down lobs higher.
  • From the keyboard, Left/Right (or Up/Down) change the angle one degree, Space is held for power and released to throw, and Enter works as Space.
  • The ball flies, and the HUD and coconuts only update when it lands, from the state shy.js returns.
  • Between rounds the HUD says what comes next, and after the game it shows the rules' win or loss line with a "play again" prompt.
  • Ambient motion is only the bunting and the stallholder, and it stops under reduced motion. The thrown ball and wobbling coconuts are play, not ambience.

Files and wiring

  • GAMES entry, root <li>, README table row and the no-music README list are in as specified.
  • bun scripts/og.mjs was run, so og/coconut-shy.png, the page's share tags and og/home.png are updated.
  • The serve.test.mjs assertion, rounds.mjs scripted round and coconut-shy/page.test.mjs are added.
  • The scripted round reaches "You win with 18 down!" in a run of its own.

Chosen not to do

  • No aim-preview of the landing spot; only a short dotted launch arrow, so the game stays about judging distance.
  • No music, per the issue.

To try it

  • Open /coconut-shy/ on the preview.

I touched no other game.

🤖 Generated with Claude Code

commented

I merged main into the branch, resolved the conflicts and pushed.

  • README.md: main added Cloakroom to the same two lines I had edited. I kept main's text and re-added Coconut Shy to the "own sound effects" list and to the ambient-motion rule.
  • og/home.png: I took main's version and regenerated it with bun scripts/og.mjs, so it includes both Cloakroom and Coconut Shy.

After the merge, the coconut-shy tests, shell.test.mjs, the coconut-shy playtests and serve.test.mjs (53 tests) all pass. I did not run the full bun test, as before; the forge runs it on the push.

Changes requested — before the latest push

Nice build on shy.js, no security findings (static page, no writes, no secrets, no user text in output). Two things to fix in one round:

  1. coconut-shy/page.test.mjs, test "a ball thrown at the first coconut knocks it off": it only asserts the HUD down equals state.down, which passes whether or not the coconut fell. Assert the throw really knocked it off (state(g).coconuts[0].down is true and down >= 1), so it fails if the page throws the wrong power or angle.
  1. Dead code in coconut-shy/index.html: const RESTING = [wx(1), 0, .2]; is never used, and G.rackRound is set in bake() but never read. Remove both. Also keeper() assigns hand and returns it for no caller; return the figure call directly or drop the return.

Not blocking: the new kind "Throwing" is fine, but note it in the pull.

commented

Both of sentinel's points are fixed and pushed, and the 20 coconut-shy tests pass. I couldn't run scripts/gate.ts or scripts/design-lint.ts because neither exists in this clone. bun x tsc --noEmit printed only its usage text and I didn't check its exit code, since the repo has no tsconfig.

What changed

  • Test: "a ball thrown at the first coconut knocks it off" now asserts that coconuts[0].down is true and that down is at least 1, before it checks the HUD.
  • The stronger test failed at first. The old loop stepped the charge a frame at a time, which is 0.033 of power. That overshot the square window, so the throw landed 0.4 m long and only wobbled the coconut. The page was right; the test was wrong. It now sets the held time to exactly the power powerFor asks for, so it fails if the page throws the wrong power or angle.
  • Dead code in coconut-shy/index.html: I removed RESTING and G.rackRound (the field and its assignment in bake()). keeper() now calls figure(...) directly and returns nothing.

Note on the new kind: the catalogue entry's kind is "Throwing", new with this pull, as sentinel observed.

commented

I merged main into the branch, resolved the conflicts and pushed. The full suite passes: 866 tests, 0 failures.

Dinghy Race landed on main while this pull was open. Every conflict came from both games adding to the same lists, so I kept both:

  • Lists: both games sit side by side in README.md, index.html, shell.js, rounds.mjs and serve.test.mjs, each with its own test.
  • README prose: the "own sound effects" list and the ambient-motion paragraph now name Dinghy Race and Coconut Shy.
  • og/home.png: I took main's binary and regenerated it with bun scripts/og.mjs, which draws a card for every game.

I did not run bun scripts/gate.ts or bun x tsc --noEmit this time. I didn't commit the stray dotfiles the sandbox leaves in the clone, such as .bash_profile and .gitconfig.

Changes requested — before the latest push

The preview serves /coconut-shy/, shy.js and the share card (200), the catalogue entry, README, scripted round and tests are in place, and I found no security findings (static, no writes). Two experience misses to fix in one round: (1) the canvas is the only keyboard control and outline: none leaves no visible focus, so a keyboard user cannot tell it is focused; fix that first. (2) The muted text colour fails contrast on white. Also, with JavaScript off the page is blank: add a <noscript> line.

commented

Add Coconut Shy, a village-fete game: drag back and release to knock five coconuts off their posts, five balls a round over three rounds. The game rules were already tested in coconut-shy/shy.js. This pull adds the playable page, a catalogue entry under a new kind, "Throwing", a share card, a scripted round in rounds.mjs and README lines. main has been merged in, so Dinghy Race and Coconut Shy both appear in the catalogue, menu, README and tests, and og/home.png was regenerated with both.

This round fixes juniper's review of coconut-shy/index.html:

  • Keyboard focus: outline: none is gone from the canvas. The canvas now gets canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }, so keyboard players can see focus.
  • Contrast: --muted is now #6b675f, which meets the 4.5:1 AA ratio on white (the old #8b877f was about 3.4:1).
  • Mute button: it now draws a 2px accent outline on :focus-visible, not just a colour change.
  • JavaScript off: a <noscript> line says the game needs JavaScript and what it is. Its styling copies Empire Age's.

A new test in coconut-shy/page.test.mjs fails if any of these regress. It checks that there is no outline: none, that both focus rules exist, that --muted meets 4.5:1 on white, and that the <noscript> text is there.

The earlier round's test now really proves a throw at the first coconut knocks it off. It holds Space for exactly the power the rules ask for; stepping frame by frame overshot and only wobbled the coconut. Dead code is gone: RESTING, G.rackRound, and the unused return from keeper().

bun test coconut-shy serve.test.mjs passes, 75 of 75. The full suite passed, 866 of 866, after the merge from main, before this round. I didn't run bun x tsc --noEmit this round. scripts/gate.ts and scripts/design-lint.ts don't exist in this repository.

To try it, open /coconut-shy/ on the preview, press Tab to focus the canvas, aim with Left and Right, and hold and release Space to throw.

🤖 Generated with Claude Code

Approved

Earlier asks, all met in the diff: (1) the canvas shows keyboard focus (canvas:focus-visible 2px outline, no outline:none), (2) --muted is #6b675f, which passes 4.5:1 on white, (3) the mute button has a focus-visible outline, (4) <noscript> explains the game. A test pins each of them. The preview serves /coconut-shy/ with 200 and the focus rules and noscript are in the served HTML. Sentinel's points (a stronger knock-off test, dead code removed) are also done. Static game with no writes or secrets, so nothing for the security items. It is reachable from the catalogue, the menu and the README. Two things I would do next, both non-blocking: Non-blocking: the power bar and the angle readout are visual only, so give the power element a role=progressbar or an aria-valuenow, or announce angle changes in the status region, so screen-reader players can aim. Non-blocking: add a visible Throw button for keyboard and switch users who cannot hold Space for a precise time.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs