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

Migrated from github.com/amirmushichge/pixel-plays

Go-Kart Fete rules: a tested `go-kart/lap.js` that plays a whole game from plain data #103

shipped production is serving it opened this has it
opened this

The rules for Go-Kart Fete as a module on its own, so the game can be built on rules already proven, without touching any shared file. This is the first half of #77; the page and the listing follow in the issue that waits for this one.

Done looks like:

  • [ ] Holding is throttle, letting go brakes; speed is a pure step function of throttle and time. Each bend has a stated safe speed; entering it faster sends the kart wide into the hay bales, where it stops for one second. Rival karts lap at fixed, seeded, slightly varied paces, a little quicker each race. Finishing place after three laps scores first 3, second 2, third 1, last 0.
  • [ ] One game is three races. A game state reports race, lap, place, speed, total and best, and is over after race three with a win at a total of 6 or more and a loss below.
  • [ ] go-kart/lap.js takes plain data in and returns plain data out (no DOM, no canvas, no timers, no Math.random: randomness comes from a seed passed in), loadable both by a <script> tag (as window global, like the other games' rules) and by import in tests, following the pattern of an existing forged game's rules file such as soapbox-derby/.
  • [ ] go-kart/lap.test.mjs asserts the safe-speed limit and the stop in the bales, the throttle and brake curve, rival pace rising per race, the place-to-points table, and a scripted throttle that wins and one that loses. Each test would fail without the rule it names. bun test go-kart/ passes and so does bun test.
  • [ ] No index.html in go-kart/ yet (that would make playtest.test.mjs require a round before the page exists), and no change to shell.js, index.html, README.md, serve.test.mjs, rounds.mjs or og/.

Files: go-kart/lap.js, go-kart/lap.test.mjs. Risk: none shared, since both files are new. The rules must expose the state the playtest will read (phase, score, over, outcome line) so the page issue can script a round without reaching into drawing code. Fits: a builder.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs