Back to Minesweeper!
Minesweeper was a popular arcade game back in the 80's when it was bundled with DOS and later with almost all GUI OSes. Today I want to post my version of the game implemented and programmed in Java.
For those of you unfamiliar with the game, don't worry, it isn't that a difficult game to play.
The interface presents you with a grid of boxes. Some of these boxes conceals a mine, which when clicked will lead to a game over. The other boxes might just be empty or might display a number which equals the number of mines immediately surrounding that box. With a little luck in the beginning several of these boxes may be opened which will make spotting mines pretty easy and quick. Once you've spotted a mine, right-click the box to flag it as a mine. You win the game if you flag all the mines in the grid without flagging any non-mine box in the process. Phew, that was all.
|Lucky to get a few empty boxes|
|Added a flag.|
The box to the top left of the flag says '1', so there's
one mine in the surrounding 8 boxes. But 7 of them
are already open, leaving just one closed box. Hence,
this is obviously a mine! Right-click, flag.
|Progressing... A few more mines spotted!|
|Good progress... But alas, missed it. :(|
The levels provided basically change the number of grids to play on, not very innovative here, I know. So, we have,
- EASY (8x8)
- MEDIUM (15x15)
- HARD (24x24)
- GIGANTIC (32x32)
- CUSTOM (Didn't implement it yet. Will update as soon as I do.)
So there, go ahead, give it a try. The links to the source code and executable is provided below. Please comment if you've any questions on the code.