An intelligent Telegram bot that automatically plays and wins Minesweeper games! This bot uses advanced algorithms to analyze the game board and make optimal moves, achieving near-perfect win rates.
demo.mp4
✨ Watch the bot in action! The video shows the bot automatically detecting its turn and making smart moves to win the game.
- Smart Algorithm: Uses constraint-based analysis to determine safe moves and mine locations
- Probability Engine: When certainty isn't possible, employs probability calculations to make the safest guess
- Automatic Play: Detects when it's your turn and plays automatically
- Real-time Analysis: Analyzes the board state in real-time after each move
- Configurable Delays: Adjustable delays to mimic human-like playing speed
- Telegram Integration: Seamlessly integrates with Telegram's Minesweeper games
The bot uses a sophisticated algorithm that:
- Parses the Board: Converts the emoji-based game board into a data structure
- Constraint Analysis: Uses numbered cells as constraints to identify mine locations
- Probability Calculation: When constraints aren't definitive, calculates mine probabilities
- Optimal Move Selection: Chooses the safest available move based on analysis
- Python 3.7+
- A Telegram account
- Telegram API credentials
-
Clone the repository:
git clone https://github.com/devmmk/minroob-expert.git cd minroob-expert -
Install dependencies:
pip install -r requirements.txt
-
Configure the bot:
- Add your Telegram API credentials:
{ "api_id": YOUR_API_ID, "api_hash": "YOUR_API_HASH", "session_name": "minsweeper", "min_delay": 1, "max_delay": 3 } - Get your API credentials from https://my.telegram.org
- Add your Telegram API credentials:
-
Run the bot:
python main.py
| Parameter | Description | Default |
|---|---|---|
api_id |
Your Telegram API ID | - |
api_hash |
Your Telegram API Hash | - |
session_name |
Telegram session name | minsweeper |
min_delay |
Minimum delay between moves (s) | 0 |
max_delay |
Maximum delay between moves (s) | 5 |
- Start a game of Minesweeper in any Telegram chat
- Invite your bot to the game
- The bot will automatically detect its turn and play
- Watch as it analyzes the board and makes optimal moves!
The bot implements several key algorithms:
- Constraint Satisfaction: Uses numbered cells as constraints to identify mine locations with 100% certainty
- Probability Analysis: Calculates the probability of each unopened cell containing a mine
- Neighbor Analysis: Examines all 8 neighbors of each numbered cell to determine safe moves
The bot achieves a high win rate by:
- Making only safe moves when certainty is possible
- Using probability to minimize risk when guessing is required
- Never making random moves when logical moves are available
Contributions are welcome! Feel free to submit issues or pull requests.
If you like this project, please give it a star on GitHub!