Watch
1
0
Fork
You've already forked puzpirobot
0
Bilging bot with simple DFS in Python. Draws stuff that needs to be pressed on screen.

To limit crawling, anonymous browsing shows current files and the last 50 commits/diffs. Clone for full history.

Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Vjeran Crnjak e5e990d2a1
feat(evaluation): validate bilging pieces across scale and water levels
- Add CLI evaluation for localization, resizing, and source-pixel water sweeps.
- Improve acquisition of cropped low-resolution boards and detect water
  independently of recognized piece brightness.
- Keep recognition fast with batched luminance correlation, cached dry/wet
  templates, and fish comparisons limited to uncertain cells.
- Verification: 80 recognition, capture, tracking, and click-forwarding tests
  pass; 525 original/resized boards and 386,400 water variants are exact.
  Paired recognition timing improves from 36-41 ms to 12-18 ms.
- Keep README focused on usage and link detailed solver benchmarks.

Co-authored-by: OpenAI Codex <codex@noreply.forgejo.crnjak.xyz>
2026-10-03 10:47:29 +02:00
docs feat(evaluation): validate bilging pieces across scale and water levels 2026-10-03 10:47:29 +02:00
match feat(evaluation): validate bilging pieces across scale and water levels 2026-10-03 10:47:29 +02:00
optimize Reduce Python overhead by returning gravity candidates in bulk arrays 2026-10-01 16:11:38 +02:00
tests feat(evaluation): validate bilging pieces across scale and water levels 2026-10-03 10:47:29 +02:00
.gitignore feat(capture): add ordered evaluation screenshot capture 2026-10-03 05:35:05 +02:00
.python-version Speed up bilging plans and stabilize live board tracking 2026-09-30 15:46:16 +02:00
evaluate_recognition.py feat(evaluation): validate bilging pieces across scale and water levels 2026-10-03 10:47:29 +02:00
evaluate_waterline.py feat(evaluation): validate bilging pieces across scale and water levels 2026-10-03 10:47:29 +02:00
LICENSE add license 2021-04-20 13:47:15 +02:00
pyproject.toml Forward preview clicks to the game with scaled desktop coordinates 2026-10-01 16:11:39 +02:00
README.md feat(evaluation): validate bilging pieces across scale and water levels 2026-10-03 10:47:29 +02:00
requirements.txt Speed up bilging plans and stabilize live board tracking 2026-09-30 15:46:16 +02:00
screen_scan.py feat(capture): add ordered evaluation screenshot capture 2026-10-03 05:35:05 +02:00
uv.lock Forward preview clicks to the game with scaled desktop coordinates 2026-10-01 16:11:39 +02:00

puzpirobot

Move suggestions for the Puzzle Pirates bilging puzzle. Captures the board and shows planned swaps with numbered corner badges, in click order.

Setup

Linux with an X11 desktop, Python 3.14, uv, and a Matplotlib GUI backend are required. On Arch Linux, install tk. Install Python dependencies with:

uv sync --locked

Supply a board header as bilging.png and single-piece templates at these paths. Game artwork is omitted and ignored by Git; piece templates are resized to 45 × 45.

images/whiteblue_square.png
images/greenblue_diamond.png
images/lightblue_circle.png
images/lightyellow_circle.png
images/darkblue_square.png
images/lightblue_square.png
images/lightblue_diamond.png
images/puffer.png
images/crab.png
images/jellyfish.png

Run

uv run python screen_scan.py
uv run --extra input python screen_scan.py --solver gravity --depth 6 --forward-clicks
uv run python screen_scan.py --screenshot screenshot.png

Keep the board and header visible beside the preview. Scale is detected automatically. Click the numbered pairs in order; wait while a swap settles. With --forward-clicks, left-click each pair in the preview to send the click to the game. This requires live capture. Close the window or press Ctrl+C to stop.

The default templates solver searches cached plans of up to six moves. Use --solver dfs for a first-clear search or --solver gravity for lookahead through clears. The first launch builds caches and compiles matching code.

Use --help for options including --depth, --monitor, --scale and --debug. See solver behavior and benchmarks for scoring assumptions, performance measurements and reproduction commands.

Evaluation dataset

uv run python screen_scan.py --dataset-dir datasets/bilging
uv run python evaluate_recognition.py datasets/bilging --export-variants --require-perfect
uv run python evaluate_waterline.py datasets/bilging --require-perfect

--dataset-dir shows a Save screenshot button. Each tap saves a fresh capture in an ordered session: screenshot.png, normalized board.png, and predictions in metadata.json. Evaluation requires a separately reviewed annotation.json per frame.

Recognition evaluation checks original images and six lower resolutions. The water sweep raises a calibrated stationary tint one source pixel at a time. Reports and resized variants go to build/recognition-evaluation/; use each script's --help for scales, output paths and quicker diagnostic runs.

For gravity evaluation, save before and after each swap and record the swapped pair. Keep the sequence in one session.

Tests

MPLBACKEND=Agg uv run python -m unittest discover -s tests -v