Skip to content

Latest commit

 

History

History
71 lines (41 loc) · 1.99 KB

File metadata and controls

71 lines (41 loc) · 1.99 KB

🧩 Ubongo Solver

Empty Puzzle

A pygame-based ubongo puzzle solver that visualizes a backtracking algorithm in real time.

The solver runs in a background thread and automatically captures and stores every valid solution as an image for later analysis.

🤔 Why Make This?

So I can keep my braincells 😁

Ubongo puzzles look simple… until you actually try solving them programmatically.

This project is my way of exploring:

  • Backtracking algorithms 🧠
  • Real-time visualization 🎮
  • Grid-based puzzle systems 🧩

🖥️ GUI

🎮 Controls

  • Left Mouse Click – Fill a grid cell (toggle between clear and blocked depending on mode)

  • Mouse Drag – Paint multiple grid cells while dragging 🖱️

  • S Key – Switch fill mode:

    • ⬛ Blocked (draw obstacles)
    • ⬜ Clear (erase cells)
  • R Key – Restart the current board (reset everything)

  • Spacebar – Start the solver 🤖

  • Q Key – Quit the application 🚪

🚀 On Startup

Empty Puzzle in Solver

🧩 Set Puzzle

Set Puzzle in Solver

⚙️ Run Solver

Solver Running

💾 Solution Storage

Every solved puzzle is automatically captured and saved as an image for later review.

When a solution is found, the current board state is exported as a screenshot and stored in a structured folder system based on the puzzle configuration.

The system encodes both:

  • 🧩 The puzzle layout (grid state)
  • 🧱 The block combination used

This ensures every solution is uniquely identifiable and reproducible.

📁 All outputs are saved under SCREENSHOT_SAVE_PATH/, organized by a generated puzzle hash derived from the board state.

📝 Each filename includes:

  • A sequential solution index (e.g. 01.jpg)
  • The IDs of the blocks used in that specific run

Which also helps trace:

  • Which block set produced which solution 🔍
  • How different combinations behave over time 📊