Dear Code of Mine

Loop
2 min readNov 3, 2018

--

For our second project, we decided to code another much loved (or hated, based on your luck) game from our childhood — Minesweeper.

Most of us used to just randomly click on the tiles, until we hit a mine. The logic for implementing this was similar; hardcode or generate a random board featuring symbols that would symbolize “mines” and the “safe places”. The player would enter his/her choice of position and an appropriate message would be displayed if a mine had been hit.

Originally, the game was developed using a two-dimensional matrix to represent the board.

But, as only some positions in the matrix would be containing the mines, sparse matrix was deemed to be a better alternative. The non-zero elements here would signify the mines. Being lesser in number, it would save memory as well as computing time as only non-zero elements would need to be traversed.

As in the previous project, the code was revised to improve the playing experience. Features like multiplayer, scorecards and playing time were added.

This project enabled the students to explore the concept of 2-D arrays while building on previously learned concepts in an interesting manner; a break from their monotonous classroom routines.

The following links are relevant to the concepts implemented in this project.*

https://beginnersbook.com/2014/01/2d-arrays-in-c-example/

The code has been uploaded on Github. The link is mentioned below.

Finally, I’d like to add that this project even enlightened us on to how to actually play Minesweeper (yes, there is a logic to it). Instructions can be found in the link attached.

https://www.wikihow.com/Play-Minesweeper

Excuse us while we go and download Minesweeper ASAP.

-Aaliyah Ahmed, on behalf of Loop, CCOEW

*Credits for the content on respective sites.

--

--

Loop
Loop

Written by Loop

Competitive coding club at Cummins College of Engineering, Pune

No responses yet