Minesweeper Applications

As a part of my CST-227 Enterprise Applications Programming II course, I developed a fully functional Minesweeper game in C#. This project went through several iterations as I progressed through the course.

As part of this project, I created a backend Minesweeper library that I could implement into multiple project in order to easily create different versions of minesweeper. For the first phase of this project, I developed the backend library while hooking it up to a console application on the frontend.

A screenshot of a console based minesweeper game
Console Version of the Minesweeper Game

I created two main objects in the Minesweeper library, the Cell object and the Board object. These objects worked on the backend to create a gameboard, populate it with cells, let the user reveal a cell to be clear or a bomb, let the user flag a cell, and end the game in victory or defeat.

In Minesweeper, if a player clicks on a non-bomb cell, the game will then clear all non-bomb cells in every direction, until it hits a non-bomb cell that is touching a bomb. This feature is also known as flood fill. I worked to build a flood fill system that used recursive logic that revealed non-bomb cells to a player. This system required a lot of fine-tuning to perfect, as this was my first serious dive into the topic of recursion and it took me a little bit to fully grasp the concept.

"To understand recursion, you must know recursion." - A Very Wise Man

After developing the main functions of the Minesweeper Library, I then worked to implement it into a Windows Form Application. This allowed me to drastically improve the user experience with the game, as now the user could easily click buttons instead of typing out commands to a command console.

A screenshot of minesweeper on a window
Windows Form Version of the Minesweeper Game

The implementation of the Minesweeper library into Windows Forms was interesting, as I needed to create a frontend button that was attached to the backend Minesweeper Cell Object being used to run the game. To mirror more effectively, I created an update board view method that was called every time the process of revealing a cell, revealing all bombs, or flagging a cell ended.

An extra feature I added onto the windows application was the addition of score tracking. This allowed users to enter in their username, play a game, and then have their score recorded. I also built the score viewer so that players could see the scores for different difficulties and board sizes.

A window showing high scores and difficulty selection
Cataloged Scores of Board Size of 1 and Difficulty of 1

Last updated