Checkout the github repo here!

Inspiration

Minesweeper has been a classic Windows game that many of us grew up playing, but it often leads to those frustrating "50/50" moments where you're forced to guess and potentially lose all your progress. I was inspired to create an application that could analyze Minesweeper boards and provide helpful suggestions, eliminating some of the guesswork and allowing players to enjoy the strategic elements of the game without the pure luck factor.

What it does

The Minesweeper Solver is an application that allows users to take a screenshot of their Minesweeper board, and then:

  • Automatically detects the grid structure using computer vision
  • Identifies all cell types (numbers, empty cells, etc.)
  • Applies logical algorithms to find definite safe moves
  • Identifies cells that definitely contain mines
  • Presents the results visually, highlighting safe moves and mines

The app features a retro Windows-style UI that matches the classic game aesthetic while providing modern functionality through a web application accessible on any device.

How we built it

Backend (Python/FastAPI):

  • Computer vision system (OpenCV) to detect the Minesweeper grid and identify cell contents
  • Multiple solving algorithms for different Minesweeper patterns:
    • Basic pattern detection (cells with satisfied number constraints)
    • 1-2-X pattern detection (special Minesweeper pattern)
    • Empty cell detection algorithm
  • RESTful API endpoints for image analysis and grid solving
  • Hosted on Render for reliability

Frontend (Angular):

  • Responsive UI with retro Windows aesthetics
  • File upload and image preview functionality
  • grid visualization of analysis results
  • Clear highlighting of safe moves and mines
  • Deployed on Vercel for global accessibility.

Challenges we ran into

  • Computer Vision Accuracy: Getting accurate grid detection was difficult.
  • Cell Classification: Reliably distinguishing between different cell types (numbers 1-8, empty cells, etc.) required fine-tuning.
  • Cross-platform Compatibility: Ensuring consistent behavior across different devices and browsers.
  • Time Constraints: Completing both sophisticated computer vision and logical solving algorithms within the hackathon timeframe.

Accomplishments that we're proud of

-Successfully implemented computer vision that can detect Minesweeper grids from screenshots.

  • Created multiple solving algorithms that can identify guaranteed safe moves.
  • Built a fully functional end-to-end application (from image upload to result visualization).
  • Designed an intuitive, retro-styled UI that enhances the nostalgic feel.
  • Successfully deployed both frontend and backend to cloud platforms for public access.

What we learned

  • Advanced OpenCV techniques for grid detection and cell classification.
  • Minesweeper solving algorithms and pattern recognition.
  • FastAPI for building high-performance Python backend services.
  • Angular service architecture for handling asynchronous API requests.
  • Deployment strategies for both frontend and backend components.

What's next for Minesweeper Solver

  • Advanced Algorithms: Implement more sophisticated solving techniques like probability analysis for non-deterministic scenarios.
  • Support for More Variants: Add support for different Minesweeper versions and custom themes.
  • Better Grid Detection: Implement grid detection for screenshots/photos that include more than just the grid.

Usage

Currently, the grid detection and cell classification is optimized for the classic windows version of minesweeper. The a similar version is available for download on windows here

If you prefer a web based minesweeper game, I suggest this at cardgames.io

Example screenshot formats have been added to project media!

Share this project:

Updates