Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZipBot

Screenshot in, solved PNG out. No mouse automation, no screen coordinates, no display-scaling headaches -- just detect the grid, solve it, draw the answer.

How it works

  1. detector.py finds the grid lines via pixel-brightness scanning (works at any resolution/crop, no hardcoded coordinates)
  2. detector.py also finds wall bars the same way (thick bright segments on cell boundaries)
  3. ocr.py reads the digit inside each numbered circle via Tesseract, with several trim/psm passes + majority voting to survive font/edge noise
  4. solver.py runs a backtracking search for a Hamiltonian path over the whole grid that visits 1..N in order, respecting walls (works with zero walls too)
  5. render.py draws the solved path as a PNG styled like the actual game board -- numbered circles, walls, and the solution traced as a colored line

Every step logs to your terminal and to zipbot.log.

Setup (one-time)

You need Python 3.9+ and the Tesseract OCR binary (pytesseract is just a wrapper around the real binary, which installs separately).

Windows:

winget install --id UB-Mannheim.TesseractOCR

Make sure the install folder (e.g. C:\Program Files\Tesseract-OCR) is on your PATH -- the installer usually offers to add it, don't skip that.

Linux (Arch):

sudo pacman -S tesseract tesseract-data-eng

Debian/Ubuntu/Kali:

sudo apt install tesseract-ocr

Then install the Python deps:

pip install -r requirements.txt

Usage

Screenshot the puzzle (crop tight -- just the grid, not the LinkedIn navbar around it), then either save it as a file or leave it on your clipboard.

From a saved file:

python main.py screenshot.png

From the clipboard (e.g. right after Win+Shift+S):

python main.py --clipboard

Either way, it writes solution.png next to the script -- open it and trace the blue line onto the real board.

Other flags:

python main.py screenshot.png --out my_solution.png   # custom output path
python main.py screenshot.png -v                      # verbose debug logging

If something goes wrong

Check zipbot.log -- every detection step is logged: exact pixel coordinates of every grid line, every wall segment and its brightness score, every OCR attempt per cell, the full numbers map, and the solved path.

"Could not detect a full grid" -- your screenshot has too much surrounding UI. Crop tighter to just the board.

OCR reads a wrong number -- run with -v and check the "Numbers map" log line before it solves. If a number looks wrong (e.g. two cells both read "1"), the puzzle's font/theme may need a tweak to the trim ratios in ocr.py.

Solver finds no solution -- almost always an OCR or wall misread, not a solver bug. Verify the numbers map and wall list in the log against what you actually see on screen.

Notes

  • The solver is fully general -- any RxC grid, any wall layout including none at all.
  • render.py's colors/sizes are simple constants at the top of the file if you want to tweak the look.

About

Solves LinkedIn's Zip puzzle from a screenshot. Computer vision + OCR to read the board, backtracking solver to find the path, renders the answer as an image... works for any ZIP puzzle

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages