with the objective to learn C#, XAML and especially MVVM I started to program the Minesweeper game. First version I made was without the MVVM part, where I created and added
Recently I solved the Minesweeper game logic, for a sort of software development contest. I think that the main issue of his game is finding the adjacent mines and the adjacent empty cells around an item. In both cases we have to consider that at most each cell (item) could be surrounded by eight items (cells). If we consider a 4x4 grid (matrix) a cell C defined by a X,Y coordinates it will be surrounded by the following cells:
C1 (X-1,Y-1)
C2 (X,Y-1)
C3 (X+1,Y-1)
C4 (X-1,Y)
C5 (X+1,Y)
C6 (X-1,Y+1)
C7 (X,Y+1)
C8 (X+1,Y+1)
In other words we can find the adjacent cells of an item by translating a point on the x and y axis.
I developed a class set by splitting the presentation of the game (front-end) by the game logic (back-end).
By using this strategy actually you can use it with different .Net environment: we don't are "locked" around UI elements or components.
You can download my project here:
https://github.com/alchimya/csharp-minesweeper-sdk