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

Migrated from github.com/amirmushichge/pixel-plays

Bumper Cars rules: a tested `bumper-cars/floor.js` where you steer a car on a walled floor and shove three seeded rivals into the wall without a head-on bump, from plain data, in a two-file pull with a test file that runs in under a second #336

Merged opened this

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

Merged

Bumper Cars rules are already on this branch in `bumper-cars/floor.js` and `bumper-cars/floor.test.mjs`, and I changed nothing this run. The test file passes (20 tests, about 44 ms), and the branch matches `origin/torque/320-bumper-cars-rules-a-tested-bumper-cars-f`, so I pushed nothing.

shipped production is serving it deploy 5b5fb07

opened this

Bumper Cars rules are already on this branch in bumper-cars/floor.js and bumper-cars/floor.test.mjs, and I changed nothing this run. The test file passes (20 tests, about 44 ms), and the branch matches origin/torque/320-bumper-cars-rules-a-tested-bumper-cars-f, so I pushed nothing.

  • Rules: you steer a car on a walled floor and shove three seeded rivals into the wall. A head-on bump doesn't count as a shove. Everything runs from plain data.
  • Tests: they pin the rival bumps, blocked shoves, events, wording and parking.
  • Not run: bun x tsc --noEmit and the gate script, because node_modules isn't installed. I didn't run bun install. The forge's check on the push covers them.

git diff origin/main --stat shows other directories, such as welly-toss, as deletions. That's only because main has moved on since this branch was cut. I didn't touch those files.

Closes #320

commented

Bumper Cars rules are already on this branch in bumper-cars/floor.js and bumper-cars/floor.test.mjs, and I changed nothing this run. The test file passes (20 tests, about 44 ms), and the branch matches origin/torque/320-bumper-cars-rules-a-tested-bumper-cars-f, so I pushed nothing.

  • Rules: you steer a car on a walled floor and shove three seeded rivals into the wall. A head-on bump doesn't count as a shove. Everything runs from plain data.
  • Tests: they pin the rival bumps, blocked shoves, events, wording and parking.
  • Not run: bun x tsc --noEmit and the gate script, because node_modules isn't installed. I didn't run bun install. The forge's check on the push covers them.

git diff origin/main --stat shows other directories, such as welly-toss, as deletions. That's only because main has moved on since this branch was cut. I didn't touch those files.

Approved

The rules module is plain data in and out, seeded through mulberry32 with the construction credited, and has no DOM, timers or Math.random. The 20 tests cover every rule in the issue: seeding, wall stop and turn, side and back shoves, wall-shove scoring and re-placement, head-on in both directions, refusals with reasons (including __proto__ and toString), the loss line and the win line. They also check that the input state is never mutated. Torque measured the run at about 44 ms. I did not run it myself or look at the preview or the screenshots, because this pull adds no page. Nothing here touches the server, a write path or a dependency.

Two things I would do next: (1) the playable page and its catalogue entry, as with Welly Toss, which should also say who made bumper cars as a ride and credit the rules as a homage; (2) let a rival choose to avoid walls, so rounds are not decided only by the pattern, and say in the page copy what a blocked shove means.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs