Skip to content

Darts: a second aiming control with two sweeping lines - #373

Merged
margani merged 1 commit into
mainfrom
issue/372-darts-bars
Oct 20, 2026
Merged

margani merged 1 commit into
mainfrom
issue/372-darts-bars

Conversation

@margani

@margani margani commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #372

Two lines, phone, Persian

What changed (www/games/darts/index.html, tools/test.js)

  • Engine: sweep(u), an even back-and-forth from -1 to 1.
  • Page: a new control. Tap (or Space/Enter) stops an upright line, then a level line; the dart goes where they cross, with the same SCATTER as before. A badge above the board switches between Drag and Two lines at once, mid-turn too; it is saved in prefs.aim (default drag, so nobody's game changes). The daily shows it as well.
  • Strings in five languages, a help paragraph, and the keyboard row.

Proof

  • node tools/test.js: 4211 checks green. With main's darts/index.html and the new tests: 6 failures (sweep, reach, saved switch, tap/Space path, switch in the daily, and the check count).
  • tools/browser-check.sh: 36 of 36 pages.
  • Playwright on a local server, 9 of 9 checks, no console errors: Persian status per stage, two touch taps throw one dart, Space then Enter throws one, the switch goes both ways and is saved, the daily has it. Screenshots at 390 px light/dark Persian and 1280 px dark English, plus the help window. The first screenshots showed the lines running past the round board into the canvas corners; they are now clipped to the board.

Not tested

  • On a real phone, so whether 1.3 s per sweep feels right is a guess from the timing maths in the commit message, not playtesting.

bars-fa-light-390-y

An upright line sweeps across the board and a tap (or Space/Enter)
stops it; a level line then sweeps and a second tap stops it, and the
dart flies to where they cross, with the same release scatter as the
drag control. A switch above the board ("Aim: Drag / Two lines") changes
the control at once, in every mode and the daily, and is kept in prefs.

The lines move at an even speed (E.sweep) from a random start each
time, 1.15 board radii each side in 1.3 s: a 45 ms late tap is about
0.08 off, close to the drag control's wobble. Lines are clipped to the
round board.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01VoRrYWfb9CHLaEtJPXc4HH
@margani

margani commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Diff review: the new control lives entirely beside the old one. barsOn() reuses canAim(), so lines never run during a bot turn, a flight, a dialog or a finished game, and fly() clears bars so the next dart starts fresh. Pointer and keyboard handlers return early in two-line mode, so the drag path is untouched when the switch is on Drag (the default). Pause clears the lines. Not covered by tests: the feel of the sweep speed on a phone.

@margani
margani merged commit b101d0e into main Oct 20, 2026
3 checks passed
@margani
margani deleted the issue/372-darts-bars branch October 20, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Darts: a second aiming control with two sweeping bars

1 participant