This bot solves the Google Minesweeper game! I was inspired to create this because I'm a lazy person
- To get started, search "minesweeper" on Google and hit play.
- Open Developer Tools (
F12
orCtrl + Shift + I
) - Click on the
Console
tab at the top of the Developer Tools panel. - Start the game by clicking anywhere on the board.
- Paste the following code into the console:
$('head').appendChild(document.createElement('script')).src='https://cdn.jsdelivr.net/gh/jwseph/google-minesweeper@main/script3.js'
- If the bot gets stuck, it usually means you have to make a guess. The bot will resume after you guess.
The bot reads the board using the RGB color data of certain pixels of each cell. Each of the numbers has a unique color.
The reason for the delays is the light-green particle effects (that appear when revealing cells) that interfere with color detection.
The solver itself relies on LogicJS, which provides logic programming support for JavaScript.
script.js
- Bot that scrapes LogiGames's minesweeper solverscript2.js
- Bot that basically uses a brute-force approach, a little buggy. Efficient but might become stuck on boards relying on info like no. of flags left, etc that are solvable but harder.script3.js
- Finished bot that uses LogicJS. Simple and complete solver