Skip to main content
← projects

May 1, 2023

Minesweeper Solver

Minesweeper Solver

JavaSwing

Objective

Create a program in Java that automatically completes a Minesweeper game.

Tools & Technologies

Swing

Share This

Details

I've always been really interested in challenging myself when it comes to programming, that's why I decided to write a Minesweeper Solver using Java. The solver takes a screenshot after which it starts to figure out the positioning of the board, makes an initial random guess and then tries to solve the entire thing.

This project was quite challenging since I first had to figure out a way to calculate the position of the board on the screen and how big the grid is (in terms of squares). After figuring out the board position the solver will click the center square and the game starts!

While making this project I learned how to use Java to capture the screen, how to perform calculations on pixels and most importantly how to start a Java project.

Source Code


Take a closer look at the solver's source code here: GitHub

Demonstration


Unfortunately 100% solvability in Minesweeper is not a guarantee, sometimes it comes down to a 50/50 guess just like in this example.

Gallery

Minesweeper solver

Minesweeper solver

Minesweeper solver

Minesweeper solver