ProbSweeper is a modern, high-performance implementation of the classic Minesweeper game, engineered with a focus on algorithmic solving and mathematical precision.
Beyond standard gameplay, this project features a custom-built Probability Engine that calculates the exact safety percentage of every tile in real-time, allowing for perfect play optimization.
- 🤖 Dual-Layer Solver:
- Constraint Satisfaction Engine: Instantly identifies 100% safe moves and guaranteed mines.
- Probability Tank: When no safe moves exist, it calculates the statistically safest guess using local probability density.
- ⚡ Modern Tech Stack: Built with React 19, TypeScript, and Tailwind CSS for a responsive, type-safe experience.
- 📱 Cross-Platform: Runs as a high-performance web app or a native Windows desktop application via Electron.
- 🎨 Advanced Gameplay: Includes Chording, Safe Start guarantees, and custom board sizes (up to 50x50).
This project was built to explore complex state management and algorithmic efficiency in React.
Located in utils/probabilityEngine.ts, the solver doesn't just guess. It models the board as a system of linear constraints:
- Witness Analysis: Groups tiles into "Boxes" based on shared constraints.
- Combinatorial Search: Calculates all valid mine configurations for the boundary tiles.
- Dead Tile Detection: Identifies tiles that offer zero information gain, optimizing the decision tree.
Th
- Node.js (v16+)
- npm or yarn
-
Clone the repository
git clone https://github.com/yourusername/Gemini-Minesweeper.git cd Gemini-Minesweeper -
Install dependencies
npm install
-
Run the development server
npm run dev
Open
http://localhost:5173to play.
To build the standalone Windows application:
npm run distThe installer will be generated in the release/ folder.
├── components/ # React UI components (Board, Cell, Game)
├── hooks/ # Custom hooks (useGameLogic, useAutoSolver)
├── services/ # External API integrations
├── utils/ # Core algorithms
│ ├── probabilityEngine.ts # The math brain
│ ├── solver.ts # Solver orchestration
│ └── boardGenerator.ts # Safe-start board generation
└── electron/ # Electron main process
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.