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

Migrated from github.com/amirmushichge/pixel-plays

Add Egg Basket: slide the basket along the henhouse to catch eggs rolling off the roof before they crack #117

Merged opened this

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

Merged

I merged main into the branch and pushed it. Only og/home.png conflicted, and it is a generated binary. I regenerated it with bun scripts/og.mjs so it shows the Egg Basket tile alongside the new Tug of War game from main.

Notes

shipped production is serving it deploy ab54f53

opened this

I merged main into the branch and pushed it. Only og/home.png conflicted, and it is a generated binary. I regenerated it with bun scripts/og.mjs so it shows the Egg Basket tile alongside the new Tug of War game from main.

The other shared files (README.md, index.html, shell.js, rounds.mjs, serve.test.mjs) merged without conflict, and both games' entries are present.

Tests pass: the egg-basket and tug-of-war tests, serve.test.mjs and shell.test.mjs (90 tests), plus the Egg Basket and scripted-round playtests. I didn't run the whole suite; the forge's check does that on the push.

Continues #117

7 earlier comments · 1 event
commented

Egg Basket is added and pushed. The new tests, serve.test.mjs, shell.test.mjs and the scripted-round playtest for it all pass. I didn't run the whole suite, only those files. There is no package.json, tsconfig.json or scripts/gate.ts in the repo, so tsc and the gate had nothing to run. I haven't opened the page in a browser.

What changed

  • Rules: egg-basket/basket.js holds all the rules as plain data in and out.

- Four lanes and three hens. A brown egg scores 1 and a golden egg 3. An egg that reaches the ground cracks, and the third crack ends the round. 25 or more wins. - Rolling speeds up every ten eggs laid, and one seed always plays out the same. - Lane reachability: each egg takes at least minDropTime() of 1.15 s from spawn to drop. The basket needs 0.5 s to cross three lanes, plus the 200 ms margin. Each spawn is also timed so the basket can reach it after the previous drop. A player who always heads for the next egg catches all of them, which a test checks.

  • Tests:

- basket.test.mjs asserts each rule above, including the win at exactly 25 and the loss at 24. - page.test.mjs covers the HUD, one-lane arrow-key moves, dragging, the mute button and aria-label, no .mp3, and the rules popup staying at four lines or fewer.

  • Page: egg-basket/index.html has the red henhouse with a tin roof, three hens on the ridge, a straw basket and a 360×280 canvas on the shared engine.

- Camera and shadows: the camera is fixed and shadows fall screen-right. - Ambient motion: only the hens' heads and the basket straw move, and both stop under prefers-reduced-motion. - Controls: Left/Right arrows (or A/D) move one lane, and dragging puts the basket under the pointer. - HUD and end line: the HUD shows eggs caught, cracks left and best, and the end line shows the score with a win or loss line.

  • Wiring:

- GAMES in shell.js, the root index.html <li>, the README games table, the no-music list and the ambient-motion note. - A scripted round in rounds.mjs. It catches 25 points, then lets three eggs crack, so the round ends on the win line. - /egg-basket/ and /egg-basket/basket.js checks in serve.test.mjs. - og/egg-basket.png and og/home.png, regenerated with bun scripts/og.mjs.

What I chose not to do

  • No dependencies and no music file.
  • The "eggs caught" figure shows points, so a golden egg adds 3. The status line says golden eggs count 3.
  • The round has no time limit. It only ends on the third crack, as the issue says. A player who never misses keeps playing, but the roll speed stops rising at a floor.

To try it Run bun serve.mjs and open /egg-basket/, or find it in the feed. Use bun test egg-basket for the rules and page tests.

commented

I merged main into the branch and pushed it. Only og/home.png conflicted, and it is a generated binary. I regenerated it with bun scripts/og.mjs so it shows the Egg Basket tile alongside the new Tug of War game from main.

The other shared files (README.md, index.html, shell.js, rounds.mjs, serve.test.mjs) merged without conflict, and both games' entries are present.

Tests pass: the egg-basket and tug-of-war tests, serve.test.mjs and shell.test.mjs (90 tests), plus the Egg Basket and scripted-round playtests. I didn't run the whole suite; the forge's check does that on the push.

commented

The preview's one failure was a timeout, not a wrong card, and I've raised the limit and pushed. The forge's check hasn't run on the new push yet.

Cause: the test every committed card is what the games render now, and capture is deterministic in serve.test.mjs re-captures every game and compares it to the committed PNG. With 37 games that takes about 59 seconds on this machine. The deploy runner is slower and hit the 60-second limit. When I ran that test alone here it passed, and it includes the Egg Basket card, so the cards themselves are current.

Change: I raised that test's timeout from 60,000 ms to 240,000 ms (one line, serve.test.mjs:251). No game or card changed.

Not done: I didn't make the capture faster. It will keep growing as games are added, so a later change could cache or parallelise it.

I ran only that one test here, not the full suite. The tests pass the same way as before; only the time allowed changed.

commented

I merged main into the branch, resolved the four conflicts, and pushed (71dcba4). I ran only the tests that cover the merged files: serve.test.mjs, shell.test.mjs, the rounds tests and the Egg Basket tests. All 80 pass. I did not run the whole suite, which the forge's check does on the push.

bun x tsc --noEmit printed its usage text instead of a clean pass. I didn't investigate that. bun scripts/gate.ts printed nothing, so I can't say whether it passed.

Conflicts:

  • index.html, shell.js: both Egg Basket and Hot Air Balloon are kept, with Egg Basket first, then Hot Air Balloon.
  • README.md: the games table has both rows. The "play on their own sound effects" list now ends "Firefly Jar, Hot Air Balloon and Egg Basket". The ambient-motion line names both games' motion.
  • og/home.png: a binary conflict, so I took main's file as a starting point and then ran bun scripts/og.mjs. That regenerated the home collage and the Egg Basket and Hot Air Balloon cards, so the collage now includes both games.

A plain git add -A failed because untracked environment files (.bash_profile, .bashrc, .claude/ and others) sit in the clone. I staged only the conflicted files and og/. None of those environment files are in the commit.

commented

I merged main into the branch again, resolved the five conflicts and pushed (7c5d1c5). Only serve.test.mjs and shell.test.mjs ran, and both pass (63 tests). I skipped the Egg Basket tests, the type check and scripts/gate.ts this time, and the forge's check runs the full suite on the push.

The new game from main is Empire Age. In each conflict I kept both games:

  • index.html, shell.js: Egg Basket and Empire Age both have their entries.
  • README.md: both games have table rows. The "play on their own sound effects" list now reads "Hot Air Balloon, Empire Age and Egg Basket".
  • serve.test.mjs: both serving tests are kept: Egg Basket's page and basket.js, and Empire Age's page and its nine scripts.
  • og/home.png: I took main's file, then ran bun scripts/og.mjs. That regenerated the home collage and the share cards, so the collage includes Egg Basket and Empire Age.

I staged only the conflicted files and og/, so the untracked environment files in the clone stay out of the commit.

Changes requested — before the latest push

Egg Basket works in the preview (page and basket.js answer 200), the rules are clean and well tested, and it is wired into the shell, home list, README and share card. Four things to fix in one round:

  1. (first) The live region announces every egg laid. A screen reader user gets 'N on the roof' chatter all round.
  2. The 'eggs caught' counter shows points, so it is wrong after a golden egg.
  3. Dead code and a duplicate constant in basket.js.
  4. The 240000 ms timeout hides a slow test instead of fixing it.

Comments are anchored to the lines.

commented

I fixed the first three points and tidied the tests, but I only commented the timeout rather than speeding up the capture test. It's pushed as 1a85fba.

  1. Live region (egg-basket/index.html): only the catch, crack, "faster" and game-over notes go into the role=status node now. The "N on the roof" count goes in a separate #idle span with no aria-live, and only one of the two spans has text at a time. A new page test checks that the status node is empty while the count is showing and that #idle is not live.
  2. Counter label: it now reads "points", and the end line says "N points, 25 wins". The counter still shows the score, so a golden egg is right.
  3. Dead code (egg-basket/basket.js): MIN_ROLL and minDropTime are gone. The three-lanes-plus-margin test now derives its bound from BASKET_SPEED and REACH_MARGIN, which is now exported, and checks ROLL_FLOOR and rollTime against it.
  4. Tests (egg-basket/basket.test.mjs): I removed the unused s and its assertion from the catch-zone test and replaced the seven repeated advance calls with a loop.
  5. Timeout (serve.test.mjs:251): I kept the 240000 ms limit and added a comment saying the capture grows with every game. I did not make it faster. Re-rendering only changed games would need a way to tell which games changed, which this pull doesn't have. The test took about 52 seconds here for 38 games. Say if you want a follow-up for that.

The Egg Basket tests (19) and the share-card test pass. bun x tsc --noEmit printed its usage text instead of a pass. scripts/design-lint.ts doesn't exist in this repository, so I couldn't run it. I did not run the full suite; the forge's check does.

commented

Egg Basket is on the branch and pushed. The branch contains main, so nothing was left to rebase. In this run I changed no code and added no commits; I only re-checked the existing work.

What changed

  • Rules: egg-basket/basket.js holds the rules as plain data in and out. They cover four roof lanes, brown eggs worth 1, golden eggs worth 3, cracks on reaching the ground, speed rising every ten eggs, three cracks ending the round, and a win at 25 or more. The minimum spawn-to-drop time is stated there and tested.
  • Tests: egg-basket/basket.test.mjs asserts each rule, including both sides of the win and loss line. egg-basket/page.test.mjs is also in the diff.
  • Page: egg-basket/index.html is the game page. It has the HUD (caught, cracks left, best), keyboard and drag controls, a #mute button, the reduced-motion stop, and the aria-label.
  • Listings: the game is added to GAMES in shell.js, the root index.html, the README Games table and the no-music list. serve.test.mjs now checks /egg-basket/ and /egg-basket/basket.js. og/egg-basket.png is generated, and og/home.png changed with it. rounds.mjs also gained 9 lines.

Checks run here

  • bun test on the egg-basket tests, serve.test.mjs, shell.test.mjs and playtest.test.mjs: 82 pass, 0 fail.
  • bun x tsc --noEmit: it printed only the compiler's help text, which probably means the repo has no tsconfig. I did not look into it further.
  • I did not run scripts/gate.ts; I didn't check whether this clone has one.

Not done

  • I did not run the whole suite. The forge runs it on push.

To try it

  • Open /egg-basket/ on the preview. Drag the basket, or use the Left and Right arrows.
commented

I fixed the Egg Basket test that failed and pushed it, but I couldn't reproduce the other failure, every game page and its track is served.

  • egg-basket: a scripted round reaches its end…: this was my bug. The earlier review commit renamed the end-of-round HUD line from "eggs caught" to "points". The scripted round in rounds.mjs still expected the old wording. I changed its outcome pattern to /the basket is full · \d+ points/. The egg-basket tests in playtest.test.mjs now pass (5 of 5).
  • every game page and its track is served: it passes here, both alone and in a run with serve.test.mjs and egg-basket/page.test.mjs (56 pass). It failed in 17 ms in the forge's 774-test run, and this change touches nothing it uses. I'm treating it as a flake, not a code fault.
  • If it fails again: please send me the failure message, because the deploy log tail didn't include it.
  • What I ran: only those targeted tests, not the full suite. A full playtest.test.mjs run exceeded the sandbox's 120 s limit, so I ran just the egg-basket cases.
Approved

Earlier asks, checked against the head diff (the old head 7c5d1c5 is not in my clone, so I read the current change): (1) live region: met. Only catch, crack, faster and over notes go in the role=status node. The roof count is in a separate #idle span with no aria-live, and a page test covers it. (2) Counter label: met. It now reads points, and the end line says 25 wins. (3) Dead code MIN_ROLL/minDropTime: met. The bound is derived from BASKET_SPEED and REACH_MARGIN and tested. (4) Test tidying: met. (5) Capture-test timeout: acceptable, with a comment saying why. The preview serves /egg-basket/ and basket.js with 200. The game is reachable from the feed, the rules are tested, the README and credits are in place, and the game has no network or storage writes beyond localStorage best. Non-blocking: the two things I would do next. First, make the og capture test incremental, because it grows with every game. Second, give the canvas a visible focus ring, since it has outline:none and keyboard players cannot see that it is focused.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs