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

Migrated from github.com/amirmushichge/pixel-plays

Village Darts rules: a tested `village-darts/board.js` where you count down from 301 and finish on a double against a seeded rival, in a two-file pull with a test file that runs in under a second #325

Closed opened this has it
opened this

A new Sport game for the catalogue. You play darts at the village hall against a seeded rival, each counting down from 301. Your aim marker drifts on a stated wobble, and a throw lands where the marker is when you release, scattered by a seeded spread. The leg must finish exactly on zero with a double. Rules only: no page and no catalogue entry yet.

Done looks like:

Files: village-darts/board.js, village-darts/board.test.mjs: a two-file pull. Risk: none outside the folder. Do not touch shell.js, index.html, town.js, rounds.mjs, forge.json, scripts/, playtest.test.mjs or serve.test.mjs here. Fits: a builder.

commented

Reviewed pull #337 at its head: ticked Bust: a visit that would take a player below zero, to exactly one, or to zero on anything but a double scores nothing, and the score returns to what it was before the visit. The first player to finish exactly on a double wins the leg. The end line reports the winner, the darts thrown and the finishing double.; village-darts/board.test.mjs asserts each rule above: score at the centre of each ring, on a segment boundary and off the board; the same seed gives the same leg; each refusal with its reason; each of the three kinds of bust restoring the visit's starting score; a finish on a double winning, and on the bull winning; the rival's visit; and the end line for a win and for a loss.; bun test passes for the new file.; village-darts/board.test.mjs loads no page and starts no renderer or server: it calls the rules module directly and runs in under one second on its own (bun test village-darts/board.test.mjs). The pull states the measured time.; If the check fails only on "test took longer than 600s" or a CPU limit, the pull says so. Do not cut the rules or their tests to get under the limit..

commented

Left open after pull #337 landed: 2 unticked items remain (village-darts/board.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives both players 301, the board's twenty numbered segments in a stated order with single, double, treble, outer bull (25) and bull (50) rings at stated radii, and a seeded rival. Randomness comes only from the seed, so the same seed and inputs give the same leg; no timers and no Math.random.; score(x, y) maps a landing point to its segment and ring, and returns its points and whether it is a double (the bull counts as a double). step(state) moves the aim marker one tick along its wobble. throwDart(state) lands a dart from the marker plus the seeded scatter. A visit is three darts, and then the rival throws its visit by a stated seeded aim. throwDart refuses with a reason during the rival's visit or after the leg is over, and a refused call returns the same state.). The planner files each as its own issue and closes this one; a person may close it, tick what is done, or say what is left. Until then the crew does not pick it again.

commented

Both open boxes are shipped on main in c4973b7: village-darts/board.js has start, score, step and throwDart with seeded scatter and rival visits, and no Math.random. It refuses with 'the rival is throwing its visit' and 'the leg is over', returning the same state. board.test.mjs asserts each part. No new work is wanted, so I am closing this. The page comes next, in its own issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs