Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Add Espresso Bar: pour each coffee to the line as cups slide past under the spout #71
Check · Review · Land · Live done — Landed and live in production.
Espresso Bar is added under /espresso-bar/, and the pour/score/lives rules are in espresso-bar/pour.js with no DOM. bun test espresso-bar serve.test.mjs shell.test.mjs passes, and the playtest suite's four Espresso Bar tests pass (boot, idle, pointer play, keyboard play).
shipped production is serving it deploy ab54f53
5 earlier comments · 1 event
Espresso Bar is added under /espresso-bar/, and the pour/score/lives rules are in espresso-bar/pour.js with no DOM. bun test espresso-bar serve.test.mjs shell.test.mjs passes, and the playtest suite's four Espresso Bar tests pass (boot, idle, pointer play, keyboard play). I didn't run the full suite, bun x tsc --noEmit or scripts/design-lint.ts. Nobody has played it in a browser. I only looked at rendered frames, so the feel of the 0.25 s delay is untested by hand.
How it plays
- Twenty glass cups slide along a belt under the spout, one at a time, in a repeating espresso/latte order.
- Each cup has a red fill line and a small order card (ESP or LAT) with a bar as long as its line. Espresso's line is at 30% of the cup and latte's at 60%.
- Hold Space, or press and hold anywhere on the canvas, to pour. The stream keeps falling for 0.25 s after release.
- A cup within 3% of its line scores 3, within 10% scores 1, otherwise 0. Going over the brim spills and costs a life. A cup that passes untouched costs a life.
- Belt speed rises 2% per cup. Three lost lives or twenty cups end the round.
- The HUD shows score, cup n of 20, lives and best (best kept in
localStorage). - The scene is drawn on the shared engine, with the machine, awning and belt baked once. Steam and the awning fringe move at 8 fps in whole pixels and stop under
prefers-reduced-motion. - The page has a
#mutebutton, no.mp3, a canvas aria-label that says how to play, and a three-line rules popup.
Wiring
- Added to
GAMESinshell.jswith the exact entry from the issue. Also added: the matching<li>inindex.html, the README Games table row, the no-music list, and the ambient-motion note. serve.test.mjsasserts/espresso-bar/and/espresso-bar/pour.jsreturn 200.bun scripts/og.mjswas run, soog/espresso-bar.png, the share tags andog/home.pngexist.pour.test.mjscovers each rule you listed, plus the 20-cup end and restart.
Choices to check
- "Within 3%" is measured as 3 points of cup height from the line, not 3% of the line's own height.
- At the top rate of 0.55 cups/s, 3% is about 55 ms of release timing, so a score of 3 is tight by design.
- The 3% and 10% bands are only about 1 px and 3 px tall on a 3.4-unit cup. The band is mostly learned from the red ring against the coffee level.
- Latte timing is tightest by cup 19, where a latte needs about 1.1 s of pour inside a window of roughly 1.45 s. If that proves too hard in play,
SPEED_UPandRATEinpour.jsare the knobs. - I added no dependencies and no HUD pour meter.
To try it, run bun serve.mjs and open /espresso-bar/, or use this pull's preview.
🤖 Generated with Claude Code
I merged main into the branch and pushed it (705e3fd..1987c50). It now merges cleanly.
README.md: main's no-music list gained Archery. I kept that list and added Espresso Bar to it. The Games table already had both rows, and the ambient-motion note is unchanged.og/home.png: I regenerated it withbun scripts/og.mjs, so the grid has both Archery and Espresso Bar. No otherog/files changed.
bun test espresso-bar serve.test.mjs shell.test.mjs passes, as do the four Espresso Bar playtests and the Archery tests. I did not run the full suite here; the forge's check runs it on this push.
I merged main into the branch again and pushed it (1987c50..81ff243). It merges cleanly now.
README.md: main added Bell Tower to the list of games without music. I kept that list and added Espresso Bar, so it now reads "Tram Line, Archery, Bell Tower and Espresso Bar play on their own sound effects". The Games table rows from both sides are intact.og/home.png: I regenerated it withbun scripts/og.mjs, so the grid now includes Bell Tower and Espresso Bar.
bun test espresso-bar serve.test.mjs shell.test.mjs passes (58 tests), as do the four Espresso Bar playtests. I did not run the full suite or the Bell Tower tests here; the forge's check runs them on this push.
I merged main into the Espresso Bar branch and pushed it. The branch now has both Espresso Bar and the newly landed Goalkeeper.
- Conflicts:
README.md,index.htmlandshell.jseach conflicted at the end of the game list. I kept both games' entries in all three files. - README music list: the "play on their own sound effects" sentence now names Bell Tower, Espresso Bar and Goalkeeper.
og/home.png: this is binary, so I tookmain's copy and then regenerated it withbun scripts/og.mjs. The grid now shows both games, and the cards for the other games were re-rendered by the same run.- Checks:
serve.test.mjsand the Espresso Bar and Goalkeeper tests pass (71 tests, 0 failures). I didn't runbun teston the whole suite, since the forge runs it on the push. This repo has noscripts/gate.tsorscripts/fast.ts, so I skipped both.bun x tsc --noEmitprinted only its usage text, so the type check didn't actually run and I can't call it green. I didn't touchsrc/web/, so I didn't run the design lint.
The game works in the preview (/, /espresso-bar/, pour.js and the og card all answer 200), the rules are tested, and the wiring is complete. Two cleanliness misses to fix in one round:
- Dead state in espresso-bar/pour.js.
seedis set in newRound(best, seed), fed byDate.now() & 0xffffin index.html, and bumped in again(), but nothing ever reads it. The game has no randomness (cups follow the fixed ORDERS list). Remove theseedfield and parameter, the Date.now argument, and thes.seed + 1in again(). Also droptimefrom the state if nothing uses it, and do not export constants nothing uses (SCORES, RESTART_AFTER) unless a test needs them.
- Duplicated code in espresso-bar/index.html cup(). The two consecutive loops that plot the red fill line at
lineZandlineZ + .05are the same loop twice. Make it one loop over[0, .05]offsets.
Also, the author said bun x tsc --noEmit did not actually run. Please run it and confirm. No other findings.
Both findings are fixed and pushed. bun x tsc --noEmit still can't type-check this repo, so I couldn't confirm a clean result there. The Espresso Bar and serve.test.mjs tests pass, 53 tests with no failures.
- Dead state in
espresso-bar/pour.js: I removedseed(the field, thenewRoundparameter and thes.seed + 1inagain()) and the unusedtimefield with its increment. TheDate.now() & 0xffffargument is gone fromindex.html.SCORESandRESTART_AFTERare no longer exported. They stay as internal constants, and no test used them. - Duplicated loop in
espresso-bar/index.htmlcup(): the two red fill-line loops are now one loop over[0, .05]offsets. tsc: the repo has notsconfig.jsonorpackage.json, sobun x tsc --noEmitprints tsc's usage text and exits 1. It isn't checking anything, which is why it showed no errors earlier. I didn't add a tsconfig, because that would change the repo's shape beyond this fix.
I also skipped scripts/gate.ts and scripts/fast.ts, since neither exists in this repo.
I merged main into the Espresso Bar branch, resolved both conflicts, and pushed. bun test passes (516 tests, 0 failures). I ran only bun test here, not bun x tsc --noEmit or bun scripts/design-lint.ts, and this repo has no scripts/gate.ts or scripts/fast.ts.
- README.md: the list of games that play on their own sound effects now names Espresso Bar alongside Goalkeeper and Wood Split. Both sides had edited that same line.
- og/home.png: I took
main's version, then regenerated it withbun scripts/og.mjsso the home collage includes both Wood Split and Espresso Bar.
To try it, open / on the preview at https://pixel-plays--71--forge-trevato-apps.open-platform.sh and find Espresso Bar and Wood Split in the game list.
Both earlier asks are met. The dead seed and time state is gone from pour.js, and the two fill-line loops in cup() are now one loop over the [0, .05] offsets. The preview serves /espresso-bar/ with 200. The game is wired into shell.js, the home list, the README (table row, no-music list, motion note) and the og cards. pour.test.mjs covers the rules, and serve.test.mjs checks the page and pour.js are served. It is static, so there is no auth, body or SQL surface. Non-blocking: tsc cannot run in this repo (there is no tsconfig), so the type check was not run.
Espresso Bar is added under
/espresso-bar/, and the pour/score/lives rules are inespresso-bar/pour.jswith no DOM.bun test espresso-bar serve.test.mjs shell.test.mjspasses, and the playtest suite's four Espresso Bar tests pass (boot, idle, pointer play, keyboard play). I didn't run the full suite,bun x tsc --noEmitorscripts/design-lint.ts. Nobody has played it in a browser. I only looked at rendered frames, so the feel of the 0.25 s delay is untested by hand.How it plays
localStorage).prefers-reduced-motion.#mutebutton, no.mp3, a canvas aria-label that says how to play, and a three-line rules popup.Wiring
GAMESinshell.jswith the exact entry from the issue. Also added: the matching<li>inindex.html, the README Games table row, the no-music list, and the ambient-motion note.serve.test.mjsasserts/espresso-bar/and/espresso-bar/pour.jsreturn 200.bun scripts/og.mjswas run, soog/espresso-bar.png, the share tags andog/home.pngexist.pour.test.mjscovers each rule you listed, plus the 20-cup end and restart.Choices to check
SPEED_UPandRATEinpour.jsare the knobs.To try it, run
bun serve.mjsand open/espresso-bar/, or use this pull's preview.🤖 Generated with Claude Code
Closes #61