Community post
[TUTORIAL] MINESWEEPER GAME - VISUAL STUDIO 2010 C#
Here it's my version of Minesweeper made in Visual Studio C#
I have to say that it was a real challenge for me to make this game in C#. I learned a lot of things and it was quite fun. Besides the classic game, my version allows the player to change the grid size, to change the maximum amount of mines on the grid and to see how much time it passed since the game started.
The project caught life when I was preparing for the C# Olympiad and I said "Let's create something fun".
So...
I searched on the net for some board games and I found minesweeper (at that time I didn't know know how to play). So it was a real challenge for me. I started to draw on a paper the project idea and what it takes, validations, what images I need, some headers for some functions and I started to build it up.
It took me like 2 or 3 days and a lot of anger because of debugging, but finally, I MADE IT !
Now I am proud of this project and I would like to share it with you.
Screens
https://steemitimages.com/DQmU6JuqmZQt5qtJLoBwch7ef7srWudW5QbbBe15cnLYDcN/1.png
https://steemitimages.com/DQmRFX8CL8riGhkDGZ4FPWHxp2XxTypX3rbaZ6tsD5oiyz1/2.png
https://steemitimages.com/DQmY2hdPt2bRek3ATzyGadWKgcpzS9jLn5nSvWcbdZmmwSU/3.png
The tutorial
https://www.youtube.com/edit?o=U&video_id=TA7aeRJ1E8c
Github (exe + source code)
https://github.com/sabauandrei98/c-Sharp/tree/master/Minesweeper%20Game
If you like my work, don't forget to upvote
Replies (3)
Had a quick scan through the code and like you have a nice consistent style :)
Small games like this teach you a lot.
Not sure why this stood out but thought I would point out. You had this piece of code
The second 'if' is not required the else means it will always be !firstPlay if the first 'if' fails
:)
Thank you! I know it is not required, but anyway, it's checked very quickly because we talk about one byte. If it was a function .. that would have been the worst case .. because of a complexity probably larger than O (1) ;)
I guess for me it is more maintenance later on. I am in a code base at work that has been growing 10 years+ and not adding the extra if means there is less chance someone will come in for a bug fix and miss updating if the main if changes etc.
The less code the better in my books, I do all I can to minimise code size. :)