Files
aspirin/README.md
T
ArdaandClaude Opus 5.5 d1f4e87526 Add aspirinV2: fixed-cell 15-puzzle
Cells never move; each NumericSelectLabel shows the number it holds
on white and the empty cell takes the board colour via a linked
backgroundColor. Adds the V2 generator, build step (with a direct-Java
sedonac fallback), offline verifier mode (--v2) and viewer support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 19:14:16 +03:00

46 lines
2.4 KiB
Markdown

# aspirin
15-puzzle (sliding 1-15) for the Ontrol **Orion** (800x480), built only from stock Sedona kits
(`control`, `ontrolControl`, `ontrolOx`, `ontrolOrion`), so it runs on the stock simulator.
| App | What it does |
|---|---|
| `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 |
## Run in the simulator
`simulatorLauncher.exe` → folder button → pick a `app-ORION-*.zip` → Start Simulator.
The simulator is headless; to watch the screen run `viewer\run_viewer.cmd`
(live view over SOX as `guest`, display only).
## Build
```bash
python build.py # gen .sax -> sedonac .sab -> launcher backup zips (all apps)
python verify_logic.py # offline scan-engine model test of the game
python verify_logic.py --solver
python verify_logic.py --v2
```
`gen_aspirin.py` holds layout, colours, shuffle length (`SHUFFLE_MOVES`) and solver delay
(`SOLVE_DELAY`); `gen_aspirinV2.py` generates V2. Paths to the Sedona install are at the top of `build.py`.
## How it works
- Each tile is a `PushButtonLabel` whose `x`/`y` are linked from logic, so tiles move.
- Tile state = offset from home cell held in `ADemux2` latches; blank cell = 3 - sum(offsets).
- A tile moves on a one-scan `OneShot` when it is next to the blank and touched (or picked
by the shuffle); it latches the blank's cell and the blank follows automatically.
- Shuffle uses a logistic-map RNG made of `Reset`/`Mul2` blocks; only legal moves, so always solvable.
- Solved = blank home and the weighted sum of tile offsets is 0 (rearrangement inequality).
### V2 (fixed cells)
- 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.
- Solved = sum of i * value_i over cells 1..15 is 1240 (its unique maximum).