Files
m3te/tests/expected/swipe_intent.stdout
swipelab f290e2614a P5.1: drag → adjacent-swap intent mapping (pure sx)
Add swipe.sx: a pure swipe_intent(layout, start, end) -> ?Swap that turns a
touch drag into an optional adjacent-swap intent (A, B). A is the cell under the
drag start (via BoardLayout.point_to_cell); B is its orthogonal neighbour along
the drag's dominant axis (larger of |dx|,|dy|, ties horizontal). Returns null for
sub-threshold drags (a tap, threshold = cell_size * 0.5), starts off the board,
or neighbours off the board. No rendering, no model mutation.

Lock the logic with tests/swipe_intent.sx (+ expected golden), feeding synthetic
down/up positions for right/left/up/down, sub-threshold tap, diagonal→dominant
(both axes), edge-outward off-board, and start-off-board. bash tools/run_tests.sh
passes (13/13); sx build --target ios-sim main.sx compiles.
2026-06-05 00:14:44 +03:00

13 lines
290 B
Plaintext

grid origin (100,0) cell 75 threshold 37
right: (3,5)->(4,5)
left: (3,5)->(2,5)
up: (3,5)->(3,4)
down: (3,5)->(3,6)
short: none
diag-horizontal: (3,5)->(4,5)
diag-vertical: (3,5)->(3,4)
offboard-right: none
offboard-up: none
start-offboard: none
ok: swipe-intent mapping resolves all cases