This is a little project I've been working on lately. It's a clone of Minesweeper implemented in Javascript. I'm not done yet but it is playable. It's missing some features that are common in Minesweeper and other clones of it, such as a timer.
It currently renders game board as a table of set size: 20x18, with 50 mines.
I don't consider this done, I certainly need to re-factor a fair bit of the code to make it more maintainable. Not to mention also easier to use. I'd also like to add a way to let the player choose his or her own play size and number of mines. Maybe even add a timer, and a way to submit scores to a central server whether that's mine or someone else's.
This is playable though. Most of what I consider to be the basics of the game is here. It will randomly generate a field of mines, put the numbers down over the whole board where they are suppose to be, if you click on a blank space then it will expand until it hits a non-zero number, I've even added the flags. If you right click on an unexplored space then it will turn yellow to flag that space as having a mine. Once you've exposed all of the spaces without mines, it will end the game and all of the mine spaces will turn green to show they are cleared. Refresh the page to start a new game.
Like I said, features that I want to add include:
- GUI for player to choose their own options.
- Timer to show how long the game has been going, starting from the first move.
- Ability to right-click on a number and, if you have the right number of adjacent spaces flagged, have it expose the remaining spaces.
- Possibly a way to submit high-scores to a website. Might not do this though, due to people who would cheat it.
- Modify the code so when you click on a mine, it will stop you from making additional moves and turn all of the mine spaces red.
- Make it impossible to click on a mine as the first round of the game. I think other variants regenerate the board before revealing that space.
This is implemented as a Single Page Application, so if you go to the file menu and save it to your drive then you can run it from there, or from a flash drive without an Internet connection. Of course if you do, you'll miss out on automatically getting any updates I post on my website. Although, maybe I could embed a version number in a variable then link it to a Javascript file on my website that simply compares the variable to a variable in it and shows a link if they don't match.