aspirinV2: tap to start with a random solvable deal

The first tap (or SHUFFLE) loads the solved board and deals it with a
Fisher-Yates pass driven by the free-running logistic-map RNG, so tap
timing picks the board. A parity latch adds one swap of cells 1 and 2
when needed, so every deal is solvable.

Tile moves and deal swaps share one cell-swap mechanism, cutting RAM
from 56.4 kB (failed to start on the Orion) to 34.6 kB (runs). Adds
deal checks to verify_logic.py --v2 and the hint label to the viewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 22:01:59 +03:00
co-authored by Claude Opus 5.5
parent d1f4e87526
commit f078dc99f3
7 changed files with 1860 additions and 2303 deletions
+11 -3
View File
@@ -7,7 +7,7 @@
|---|---|
| `aspirin.sax` / `app-ORION-aspirin.zip` | Playable game: auto-shuffle at start, tap a tile next to the gap to slide it, SHUFFLE button, move counter, SOLVED! |
| `aspirin_solver.sax` / `app-ORION-aspirin_solver.zip` | Demo: shuffles 30 moves, then an auto solver plays one move per second until SOLVED! (it records the shuffle and replays the inverse moves) |
| `aspirinV2.sax` / `app-ORION-aspirinV2.zip` | Same game with fixed cells: nothing moves, each cell shows the number it holds on white, the empty cell takes the board colour |
| `aspirinV2.sax` / `app-ORION-aspirinV2.zip` | Fixed cells: nothing moves, each cell shows its number on white, the empty cell takes the board colour. Tap to start deals a random solvable board |
## Run in the simulator
@@ -40,6 +40,14 @@ python verify_logic.py --v2
- 16 `NumericSelectLabel` cells; `in` = the number held (0 = empty), text list ` ;1;2;...;15;`.
- `backgroundColor` is linked from logic: white for a number, board colour for the empty cell.
- State = 16 cell values in `ADemux2` latches (boot loads the solved board). Blank position is
derived from the values; a move latches 0 into the touched cell and its value into the blank.
- State = 16 cell values in `ADemux2` latches (boot loads the solved board).
- One swap mechanism moves values: each scan at most one pair of cells (A, B) exchanges values.
A tile move swaps the touched cell with the blank (new touch only, and only when adjacent).
- No shuffle moves: the first tap (or SHUFFLE) deals. It loads the solved board, then a
Fisher-Yates pass swaps cell i = 15..2 with a random cell j <= i, one swap per scan
(~1.5 s). The logistic-map value is made ~uniform with a `Linearize` (arcsine CDF). The RNG
runs from boot, so tap timing picks the board. The blank starts in cell 16.
- Solvability: with the blank home, a deal is solvable iff it is an even permutation; a parity
latch counts real swaps and an odd deal gets one extra swap of cells 1 and 2.
- Solved = sum of i * value_i over cells 1..15 is 1240 (its unique maximum).
- Keep RAM in mind: the Orion failed to start a 56 kB build of V2; the current one is ~35 kB.