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

Migrated from github.com/amirmushichge/pixel-plays

Add Library Shelf: the playable page and its place in the catalogue, on the rules in `library-shelf/shelf.js` #285

Merged opened this

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

Merged

Library Shelf is now a playable page at /library-shelf/, built only on library-shelf/shelf.js, and it is listed in the catalogue. All 8 new page tests, serve/shell/town/plaza and the library-shelf cases of playtest.test.mjs pass.

Notes

shipped production is serving it deploy ab54f53

opened this

Library Shelf is now a playable page at /library-shelf/, built only on library-shelf/shelf.js, and it is listed in the catalogue. All 8 new page tests, serve/shell/town/plaza and the library-shelf cases of playtest.test.mjs pass. I did not run the full bun test or tsc (the repo has no tsconfig/package.json; I didn't check for scripts/gate.ts), and I never opened the page in a real browser, so the drawing is checked only through the pixel-capture test harness. main had not moved, so no rebase was needed.

  • The page: it draws an oak shelf with two runners and a dashed slot where the returned book must land. You drag a book along its runner, or press Tab to choose one and use the arrow keys for one cell at a time. U or the undo button undoes, and R restarts the level. The HUD shows level, name, slides, par and points straight from the rules state.
  • Dragging: a drag is limited to what M.slide accepts, so the book stops at the book or shelf end in its way. Tab moves from book to book and leaves the canvas after the last one, so keyboard focus isn't trapped.
  • Visual rules: the returned book is the red one and also has a ribbon bookmark. Every spine has an arrow for its sliding axis. Shadows fall screen-right, and the dust motes stop under prefers-reduced-motion. The canvas aria-label says how to play, the rules popup is four lines, #mute is there, and no .mp3 is committed.
  • Catalogue: the GAMES entry and root <li> are added exactly as specified. The town building comes from the GAMES list, so town.js needed no edit. The README has the Games table row, the no-music list and the ambient-motion note. bun scripts/og.mjs was run for og/library-shelf.png and og/home.png.
  • Tests: rounds.mjs has a scripted round that drags each book along the rules' own solve plan until the shelf is cleared. serve.test.mjs asserts /library-shelf/ and /library-shelf/shelf.js answer 200. library-shelf/page.test.mjs covers drag, refusal, Tab and arrows, undo, level advance, the draw-once-per-change rule, mute, and the page-source checks.

I added no game rules and no dependencies. There is no hint button, though solve is there for one if you want it.

To try it, run bun serve.mjs and open /library-shelf/.

Closes #271

commented

Library Shelf is now a playable page at /library-shelf/, built only on library-shelf/shelf.js, and it is listed in the catalogue. All 8 new page tests, serve/shell/town/plaza and the library-shelf cases of playtest.test.mjs pass. I did not run the full bun test or tsc (the repo has no tsconfig/package.json; I didn't check for scripts/gate.ts), and I never opened the page in a real browser, so the drawing is checked only through the pixel-capture test harness. main had not moved, so no rebase was needed.

  • The page: it draws an oak shelf with two runners and a dashed slot where the returned book must land. You drag a book along its runner, or press Tab to choose one and use the arrow keys for one cell at a time. U or the undo button undoes, and R restarts the level. The HUD shows level, name, slides, par and points straight from the rules state.
  • Dragging: a drag is limited to what M.slide accepts, so the book stops at the book or shelf end in its way. Tab moves from book to book and leaves the canvas after the last one, so keyboard focus isn't trapped.
  • Visual rules: the returned book is the red one and also has a ribbon bookmark. Every spine has an arrow for its sliding axis. Shadows fall screen-right, and the dust motes stop under prefers-reduced-motion. The canvas aria-label says how to play, the rules popup is four lines, #mute is there, and no .mp3 is committed.
  • Catalogue: the GAMES entry and root <li> are added exactly as specified. The town building comes from the GAMES list, so town.js needed no edit. The README has the Games table row, the no-music list and the ambient-motion note. bun scripts/og.mjs was run for og/library-shelf.png and og/home.png.
  • Tests: rounds.mjs has a scripted round that drags each book along the rules' own solve plan until the shelf is cleared. serve.test.mjs asserts /library-shelf/ and /library-shelf/shelf.js answer 200. library-shelf/page.test.mjs covers drag, refusal, Tab and arrows, undo, level advance, the draw-once-per-change rule, mute, and the page-source checks.

I added no game rules and no dependencies. There is no hint button, though solve is there for one if you want it.

To try it, run bun serve.mjs and open /library-shelf/.

Approved

Library Shelf is served on the preview (/library-shelf/ and /library-shelf/shelf.js both answer 200). The page drives the game only through the rules' slide, undo and restart. Keyboard works: Tab walks the books and then leaves the canvas, arrows slide, U and R work, and there are 44px buttons and a live status line. I could not open the forge's screenshots (the sandbox denies that path), so the drawing is judged from the source only.

Two things I would do next:

  1. Make the ribbon and spine-arrow test check pixels. Today it greps the page source, so it would pass even if the ribbon drew in the wrong place.
  2. Say something when undo is pressed on a finished shelf. It currently does nothing, silently.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs