Version 4 (modified by jtv, 14 years ago) (diff)



This project is brand-new, so don't expect to find much here just yet.

"libmines" is yet another implementation of the infamous Minesweeper game--but as a library this time.

I'm sure you know the Minesweeper game: you start out with a rectangle of water, divided into squares. Each of the squares may or may not contain a mine; you find out by clicking on it. If it held a mine, you die. If it didn't, it shows the total number of mines present in the eight surrounding squares. This hopefully gives you enough information to figure out that some neighbouring square is also "safe," and so on. Sometimes the game helps you a bit by revealing the squares that are absolutely obvious automatically.


Believe it or not, there were still reasons to write a new Minesweeper. Some of these were:

  • Clean separation of user interface and game logic. This project is currently all about the game logic. Others write better user interfaces than I can, so why not let them?
  • Different rules. Viewing the game logic separately from presentation allows for variations on the game. For instance, most Minesweeper games won't ever reveal mines--all you can do is set little flags to remind you where you deduce the mines must be. That's different here, if your user interface will support it. Also, the library can reveal the safe squares around the edge of the minefield right away to help get you started. Most other versions of the game let you gamble and die a few times before you get a decent start!
  • Intelligence. "Normal" Minesweeper games will help you a bit if you hit a square with no nearby mines: they will automatically reveal the neighbouring squares, and if any of those is also near 0 mines, that square's neighbours are also revealed and so on. This still leaves a lot of squares that are "obviously safe" to me, but need to be clicked anyway. This is where I usually make most of my mistakes. Instead, this library has multiple levels of intelligence for automatically revealing squares.
  • Keep your brain working. With smarter "auto-completion" of the game, the player is left with the interesting problems--the little puzzles that make the game fun. Now you can tackle much larger minefields at higher difficulty levels, without wasting time on the easy parts. It's okay to be addicted to puzzle games, as long as they keep exercising your mind. A regular Minesweeper game turns into drudgery after a while.
  • Large-scale games. Once the mindless clicking has been eliminated, there's no real reason why we can't play on huge playing fields with lots of mines. Games can be saved and restored, so take your time!

Getting the Source

There are many, many ways of getting access to the source code repository:

  1. The option bar on this site has a Browse Source option, which gives you full historical information.
  2. Another way of looking at the same information is through WebSVN.
  3. The same repository can be accessed (though not modified) anonymously by directing a Subversion client at svn://
  4. Releases will be made available through http and ftp.