Automated solver for the LinkedIn ZIP puzzle: Hamiltonian path visiting all free cells exactly once, hitting numbered checkpoints (1→N) in order, avoiding walls. Uses DFS backtracking (not A/shortest-path).*
- ✅ Live extraction: Auto-opens Chrome, scrapes puzzle from LinkedIn game page.
- ✅ Test mode: 5x5 mock puzzle for quick verification.
- ✅ Animated visualization: Step-by-step path replay (play/pause/step, speed control).
- ✅ Validation: Checks path coverage, numbers order, no crossings/walls.
- Clone/download project.
- Install deps:
(selenium, webdriver-manager – auto-downloads ChromeDriver)
pip install -r LinkedinZipSolver/requirements.txt
Requirements: Python 3.8+, Chrome browser.
cd LinkedinZipSolver
python main.py
GUI opens:
| Button | Action |
|---|---|
| 🎮 Solve Live Puzzle | Opens browser → LinkedIn ZIP → extracts → solves → animates. no need to Login to LinkedIn! |
| 🧪 Test 5x5 Puzzle | Mock grid → solves → animates (for testing). |
| ❌ Exit | Quit. |
Live Workflow:
- Navigate browser to LinkedIn ZIP.
- Click "Solve Live" → Auto-extracts grid/numbers/walls → Finds path → Opens viz window.
- Use controls: ▶ Play, ⏮ Start, ⏩ Next, speed slider.
Viz Controls:
- Step through path, see green lines/dots (red current), numbers always visible.
- Status: Position/Value, progress bar.
GUI (main.py)
├── Test: Mock puzzle (worker.py) → Solver → Visualizer
└── Live: Worker thread → Selenium browser → Extractor → Parser (models) → Solver → Queue → Visualizer
ASCII Flow:
Live Puzzle (LinkedIn)
↓ (Selenium)
Extractor.py (grid, numbers, walls)
↓
Models.py (GridParseResult)
↓
Solver.py (BFS reachable + DFS backtrack)
↓ Validate
Visualizer.py (Tkinter animation)
| File | Purpose |
|---|---|
main.py |
Tkinter GUI: Buttons, status, result polling, viz launcher. |
worker.py |
Background threads: Selenium setup, mock puzzle, queue results. |
extractor.py |
Parses live DOM → grid (0=free, N=number), walls (blocked edges). |
models.py |
Data: GridParseResult (grid, rows/cols, blocked_edges, etc.). |
solver.py |
ZipSolverCore: _neighbors, reachable BFS, solve_zip_game (backtrack), validate_solution. |
visualizer.py |
Tkinter canvas: Grid/walls/path animation (lines/dots, numbers on top). |
requirements.txt |
selenium, webdriver-manager. |
- Extraction: Selenium loads game → Finds canvas/elements → Computes positions → Builds grid/walls.
- Parsing: Grid[int[][]]: 0=empty, N=checkpoint. Walls as
frozenset({(r1,c1),(r2,c2)})edges. - Solve:
- BFS: All reachable from #1.
- Backtrack: From #1, extend path to unvisited neighbors, match next number, full coverage + end at max N.
- Viz: Canvas grid (blue=#cells), black walls, green path lines, small dots (red current), numbers overlaid.
Puzzle Rules (enforced):
- Start #1 → End max N, numbers in order.
- Visit all reachable free cells exactly once (no crosses/revisits).
- Walls block moves.
- Backtrack if stuck.
- Mock puzzle: Edit
create_mock_puzzle()in worker.py. - Viz tweaks: Colors/sizes/speed in visualizer.py.
- Solver: Adjust neighbor order for faster paths.
Enjoy solving! 🚀