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
Check · Review · Land · Live done — Landed and 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.
shipped production is serving it deploy ab54f53
4 earlier comments · 3 events
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.jsas 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#mutebutton 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
GAMESentry, the matching<li>inindex.htmland the README Games table row. I appended Wood Split to the README's no-music list.serve.test.mjsnow asserts/wood-split/and/wood-split/block.jsanswer 200. I ranbun scripts/og.mjs, which wroteog/wood-split.png, the share tags and a regeneratedog/home.png. - Tests: the new
block.test.mjshas 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.
Wood Split is close. The wiring is right: the GAMES entry, the index <li>, the README rows, the og card and the serve test are all there. The preview serves /, /wood-split/, /wood-split/block.js and /og/wood-split.png, all 200. Against the head as served by the preview, block.test.mjs, serve.test.mjs, shell.test.mjs and the four playtest.test.mjs Wood Split cases all pass. The app is static, with no src/tty.ts and no writes or identity, so the security and terminal items don't apply.
The one thing to fix first is that what the page shows and what the rules judge don't match.
- Fix first: the tilted crack and the full-length blade marker hide the point that is scored.
judgescores|aim - log.offset|, which is where the crack crosses the row b=0. The crack is drawn leaning up to ±0.6 rad (CRACK_TURN), anddrawBladedraws the aim as a line across the whole log top. A straight line always crosses a slanted crack somewhere on the disc, so the blade looks 'on the crack' over most of the sway. Take angle 0.6 and offset 0.5: at the near rim the crack sits about 1 unit from the judged point, nearly three timesNEAR(0.38). Even the crack's visual midpoint is off by up tooffset·sin²(angle)≈ 0.16, which is the wholeCLEANband. A first-time player who does what the hint says ('let go with the blade on the crack') gets 'missed the crack' with nothing on screen to explain it. Pick one of these:
- (a) Judge the crack where the blade actually lands, and draw the marker as the axe-head footprint at b=0 rather than a chord across the log.
- (b) Make the angle matter in the rules: score the distance between the blade line and the crack along the axe-head's length, test it in block.test.mjs, and keep the marker matching that.
Either way, add a test that fails today. For example: a log with angle: .5 and a swing that lands where the drawn crack meets the blade's footprint should not stick.
- The woodpile stops growing after 10 logs.
PILE_ROWS = [6,5,4,3,2,1]caps the pile at 21 halves, but a steady player splits far more than 10 logs in 60 s. After that, the issue's 'split halves stack on the woodpile' quietly stops being true. Grow the pile for the whole round: add more rows, or start a second stack. - Clean-ups:
const hz = headZ, ha = headA;infarmer()only renames two variables, so drop it. Inblock.test.mjs, the first swing in 'a full-strength swing on the crack splits it clean for 3' (out) is only checked for not-null. Either assert what it scores or remove it, so the test reads as one case.
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)inwood-split/block.js, which gives where the leaning crack crosses rowb.judgemeasures the crack atb = 0, which is where the axe head lands. The page now draws the same crack fromcrackAt. The marker is now a short footprint onb = 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/haaliases infarmer(). 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.
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 withbun scripts/og.mjs, so it includes Tram Line and Wood Split. The share cards are deterministic, so the regenerated collage matches whatserve.test.mjschecks. - Tests: I ran
serve.test.mjs,shell.test.mjs,wood-splitandtram-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.
Earlier asks are met. The blade marker is now a short footprint on the judged row b=0, drawn from the same crackAt that judge uses, with tests for the leaning crack and the marker length. The woodpile grows across three stacks, enough for a full round. The merge with main left the README and og/home.png consistent. The preview answers 200 and the wiring (GAMES, index li, README, serve test) is complete. This is a static game, so the server-side security items do not apply. Non-blocking: the second and third pile stacks were never checked in a browser, so a look at them is worth a minute.
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.jsandserve.test.mjs, Wood Split now sits next to Bell Tower and Archery, the new games frommain. InREADME.md, the list of games with no music track now also names Wood Split. og/home.png: I tookmain's copy of the binary, then ranbun scripts/og.mjsto 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/.
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 keptmain'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 tookmain's copy of the binary, then regenerated it withbun 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-runtsc; there's still no tsconfig, so it only prints a usage banner.
Approved. Since my last review the branch only took merges of main, with conflicts kept on both sides in README, index.html, shell.js and serve.test.mjs. The base commit a9532b3 is not in my clone, so I read the full change instead of the diff since that head. The preview serves /wood-split/ and /wood-split/block.js with 200. The rules are plain data in and out, the judged point matches the drawn blade marker via crackAt and FOOT, and the block tests cover each behaviour added, including the leaning crack and marker length. The wiring (GAMES entry, index.html li, README row, no-music list, og card, serve test) is complete. This is a static game site with no accounts or tty, so the security and terminal items do not apply. Non-blocking: tsc has no tsconfig here, so it checks nothing.
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.mjsand the Wood Split playtests pass here. I did not run the whole suite.bun scripts/design-lint.tsdoesn't exist in this repo, so it wasn't run.wood-split/block.jsas 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.prefers-reduced-motion. The page has a#mutebutton and no.mp3. The rules popup is four lines and the canvas aria-label explains how to play.GAMESentry, the matching<li>inindex.htmland the README Games table row. I appended Wood Split to the README's no-music list.serve.test.mjsnow asserts/wood-split/and/wood-split/block.jsanswer 200. I ranbun scripts/og.mjs, which wroteog/wood-split.png, the share tags and a regeneratedog/home.png.block.test.mjshas 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 whateverforge.jsonnames) 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