A simple Minesweeper game for web browsers.
Play Minesweeper using Minesweeper.js right now without any programming knowledge! Just click here to start playing.
-
Add the following code to your HTML file:
<script src="https://cdn.jsdelivr.net/gh/Navid079/minesweeper.js/index.js"></script> <!-- or minified version (About 2.9 KB) --> <!-- <script src="https://cdn.jsdelivr.net/gh/Navid079/minesweeper.js/index.min.js"></script> -->
Create a <canvas> element with id="navid079:minesweeper".
Configure and start the game:
const config = {
width: 10, // Number of tile columns
height: 10, // Number of tile rows
w_size: 70, // Tile width
h_size: 70, // Tile height
nMines: 10, // Number of mines
color: {
// Tile colors
unknown: '#1a1a1a', // Not selected yet
opened: 'white',
mine: 'red',
flagged: 'purple',
border: '#a1a1a1',
label: 'black',
},
};
minesweeper.start(config);And you're ready to go!
- 1.0.0: Initial release
- Add a timer
- Implement game signals (reset, etc.)
- Add sprite support
Please send your comments, suggestions, and bug reports to my e-mail with the subject minesweeper.js-<title>. Feel free to fork, commit, and send pull requests.
Let's make Minesweeper.js better together!