WPF Minesweeper
This project started out as a friendly competition between friends to see who could come up with a minesweeper implementation faster. While the initial version of this project was whipped up in a few hours, the more we looked at it, the more intricacies we wanted to emulate, and emulate as close to the real thing as possible. What we’ve realized is that while the game itself might not be that complicated, making sure it looks right, and emulates the full Minesweeper feature set is a little more involved.

For example, most implementations done in WPF and Windows Forms use buttons for the tiles, this doesn’t really work as the buttons trap focus on mouse down until the user releases the mouse button. You’ll see that in the real minesweeper game, you can hold the mouse button down and roll over tiles, we have this working as well using the Behavior pattern and creating an IsMouseDown attached property.

To minimize the boiler plate code in this application we factored out the implementation of INotifyPropertyChanged into initially a base class (not that fast, and had issues with refactoring), and then into a proxy class generator. As the proxy generator matured we moved it into a new project called SwiftMVVM since we feel there is a lot of value in our implementation that can be used elsewhere in other WPF projects.

So, where have we gotten so far? The game is modeled after the Minesweeper game that ships with Windows 7. We have a full game implementation, the ability to customize the map, and choose themes. We also have user based statistics. At this point our goal is to put the icing on the cake so to speak, we just added keyboard support to the game board, as well as some sounds.

On the horizon we’re going to be working on animating the mines when they’re uncovered and board animations as a whole which should be interesting.

Last edited Jul 18, 2012 at 4:45 AM by godzilla76, version 3