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

Migrated from github.com/amirmushichge/pixel-plays

Add Wood Split: split logs on a chopping block by bringing the axe down on the crack #67

opened this

Merged 34d 22h ago, live in production

Wood Split is added as a forged game: a log with a grain crack on a chopping block in a farmyard, a figure with an axe, a woodpile and two pecking hens, floating on white. Type check, wood-split/block.test.mjs, serve.test.mjs, shell.test.mjs and the Wood Split playtests pass here. I did not run the whole suite.

Notes

opened this

Wood Split is added as a forged game: a log with a grain crack on a chopping block in a farmyard, a figure with an axe, a woodpile and two pecking hens, floating on white. Type check, wood-split/block.test.mjs, serve.test.mjs, shell.test.mjs and the Wood Split playtests pass here. I did not run the whole suite. bun scripts/design-lint.ts doesn't exist in this repo, so it wasn't run.

  • Rules: they live in wood-split/block.js as plain data in and out. Holding builds strength to a peak at 1.0 s, with full strength lasting until 1.45 s. Past that the arms tire, down to a floor of 0.15. The aim sways across the log top, one pass in 3 s.
  • Scoring: on the crack at full strength is 3. Within 0.38 of the crack scores 1, and so does a clean-aimed swing with strength between 0.5 and full. Off the crack, or under half strength, sticks the axe. A stuck axe locks out new swings for 2 s while the clock keeps running. The same log waits. A split brings a new log with a new crack angle and a 25% chance of a knot, never on the first log. Knotty logs need full strength.
  • Page: the log and axe are drawn point by point at 360x280. The HUD shows score, logs split, seconds, best and a strength bar with a mark at full strength. The round is 60 s, and split halves stack on the pile. The hens peck and the grass sways, and both stop under prefers-reduced-motion. The page has a #mute button and no .mp3. The rules popup is four lines and the canvas aria-label explains how to play.
  • Input: press and hold anywhere on the canvas, or hold Space or Enter, to raise the axe. Letting go swings. Tapping or pressing a key after the round ends starts a new one.
  • Wiring: I added the GAMES entry, the matching <li> in index.html and the README Games table row. I appended Wood Split to the README's no-music list. serve.test.mjs now asserts /wood-split/ and /wood-split/block.js answer 200. I ran bun scripts/og.mjs, which wrote og/wood-split.png, the share tags and a regenerated og/home.png.
  • Tests: the new block.test.mjs has 16 tests and covers the cases in the issue plus a first-time-player check. A player who lets go as the blade nears the crack splits a log within four swings. The existing playtest suite picks the game up on its own.

The crack's tilt is for the eye only. Scoring uses where the crack crosses the line the blade sways along. I skipped any dependency, a background track, and a per-game round-winning script.

To try it, run bun run src/server.ts (or whatever forge.json names) and open /wood-split/. Hold, and let go as the yellow blade crosses the crack while the bar is past the dotted mark.

Closes #57

4 earlier comments · 1 event
commented

Wood Split is added as a forged game: a log with a grain crack on a chopping block in a farmyard, a figure with an axe, a woodpile and two pecking hens, floating on white. Type check, wood-split/block.test.mjs, serve.test.mjs, shell.test.mjs and the Wood Split playtests pass here. I did not run the whole suite. bun scripts/design-lint.ts doesn't exist in this repo, so it wasn't run.

  • Rules: they live in wood-split/block.js as plain data in and out. Holding builds strength to a peak at 1.0 s, with full strength lasting until 1.45 s. Past that the arms tire, down to a floor of 0.15. The aim sways across the log top, one pass in 3 s.
  • Scoring: on the crack at full strength is 3. Within 0.38 of the crack scores 1, and so does a clean-aimed swing with strength between 0.5 and full. Off the crack, or under half strength, sticks the axe. A stuck axe locks out new swings for 2 s while the clock keeps running. The same log waits. A split brings a new log with a new crack angle and a 25% chance of a knot, never on the first log. Knotty logs need full strength.
  • Page: the log and axe are drawn point by point at 360x280. The HUD shows score, logs split, seconds, best and a strength bar with a mark at full strength. The round is 60 s, and split halves stack on the pile. The hens peck and the grass sways, and both stop under prefers-reduced-motion. The page has a #mute button and no .mp3. The rules popup is four lines and the canvas aria-label explains how to play.
  • Input: press and hold anywhere on the canvas, or hold Space or Enter, to raise the axe. Letting go swings. Tapping or pressing a key after the round ends starts a new one.
  • Wiring: I added the GAMES entry, the matching <li> in index.html and the README Games table row. I appended Wood Split to the README's no-music list. serve.test.mjs now asserts /wood-split/ and /wood-split/block.js answer 200. I ran bun scripts/og.mjs, which wrote og/wood-split.png, the share tags and a regenerated og/home.png.
  • Tests: the new block.test.mjs has 16 tests and covers the cases in the issue plus a first-time-player check. A player who lets go as the blade nears the crack splits a log within four swings. The existing playtest suite picks the game up on its own.

The crack's tilt is for the eye only. Scoring uses where the crack crosses the line the blade sways along. I skipped any dependency, a background track, and a per-game round-winning script.

To try it, run bun run src/server.ts (or whatever forge.json names) and open /wood-split/. Hold, and let go as the yellow blade crosses the crack while the bar is past the dotted mark.

commented

I've changed Wood Split so the blade marker shows exactly where judge scores, and the woodpile now keeps growing for the whole round. I ran the full suite once, by accident, since scripts/fast.ts isn't in this clone. It passed (413 tests). I ran bun x tsc --noEmit and scripts/design-lint.ts too, but neither ran: tsc printed its help text and the lint script wasn't found, so neither has checked this change. The bun x tsc --noEmit failure may be a missing tsconfig.json, which I didn't check.

  • Judged point and marker: Scoring now uses a new crackAt(log, b) in wood-split/block.js, which gives where the leaning crack crosses row b. judge measures the crack at b = 0, which is where the axe head lands. The page now draws the same crack from crackAt. The marker is now a short footprint on b = 0 (±FOOT = 0.18) instead of a chord across the whole log. At the steepest lean (0.6 rad) the crack under the footprint drifts about 0.12 from the judged point, inside the clean band (CLEAN = 0.16).
  • Your suggestion (b) not taken: I went with your option (a) rather than scoring along the axe head's length. That would have penalised every tilted log, even when the blade sits right on the crack.
  • New tests:
    • Leaning crack: a log with angle: .5 is judged clean when the aim is at crackAt(log, 0). It sticks when the aim is only where the crack crosses the rim, about 1 unit away, nearly three times NEAR.
    • Marker length: the crack under the footprint stays within CLEAN at ±0.6 rad.
    • These tests call crackAt and FOOT, which didn't exist before, so they would have failed on the old code.
  • Pile: It is now up to three stacks of 21 halves, with the next stack set 1.5 units back (STACK_GAP). That holds 31 logs, enough for a 60 s round. I haven't looked at it in a browser, so the second and third stacks' placement is unchecked.
  • Clean-ups: I removed the hz/ha aliases in farmer(). I also dropped the unchecked first swing from the "splits it clean for 3" test, so it reads as one case.

To try it, open /wood-split/ on the preview. Hold, let go with the short gold mark on the dark crack, and keep splitting past 10 logs to watch the pile grow.

commented

I merged main into the branch, resolved the two conflicts and pushed. The merge commit is a9532b3.

  • README.md: The list of games that play on their own sound effects now names both additions: "…Tightrope, Tram Line and Wood Split play on their own sound effects".
  • og/home.png: I took main's version and regenerated it with bun scripts/og.mjs, so it includes Tram Line and Wood Split. The share cards are deterministic, so the regenerated collage matches what serve.test.mjs checks.
  • Tests: I ran serve.test.mjs, shell.test.mjs, wood-split and tram-line (76 pass, 0 fail). I did not run the whole suite after the merge, so the forge's check will be the full run.
the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

I merged main into the branch, resolved the five conflicts keeping both sides, and pushed. The full bun test run passes (476 tests). bun x tsc --noEmit printed only its usage banner, so it checked nothing: the repo has no tsconfig.

  • Text conflicts: In README.md, index.html, shell.js and serve.test.mjs, Wood Split now sits next to Bell Tower and Archery, the new games from main. In README.md, the list of games with no music track now also names Wood Split.
  • og/home.png: I took main's copy of the binary, then ran bun scripts/og.mjs to regenerate it. I didn't check that the grid shows Wood Split, Bell Tower and Archery.

I didn't run bun scripts/design-lint.ts, since the merge didn't touch src/web/.

commented

I merged main into the branch again, resolved the two conflicts, and pushed (05b91aa).

  • README.md: The conflict was in the "Add a game" paragraph. I kept main's version, which names Goalkeeper, and added Wood Split to its list of games that play on their own sound effects.
  • og/home.png: I took main's copy of the binary, then regenerated it with bun scripts/og.mjs. I didn't check that the grid shows Wood Split.
  • Tests: I ran only serve.test.mjs (41 pass), not the full suite. It checks the game list, the share cards and the served pages, which is where the merge changed things. I didn't re-run tsc; there's still no tsconfig, so it only prints a usage banner.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs