I heard you plan on doing a Minesweeper...

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
TheTask1337
Posts: 21
Joined: October 30th, 2014, 9:10 pm

I heard you plan on doing a Minesweeper...

Post by TheTask1337 » February 25th, 2017, 8:30 pm

I have just finished my attempt on making a Minesweeper clone. I tried to do it the object-oriented way and in console. I am very curious to see what do you think!


https://github.com/TheTask/MineSweeperClone

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: I heard you plan on doing a Minesweeper...

Post by chili » February 26th, 2017, 7:31 am

I will take a look and get back to you :)
Chili

Byteraver
Posts: 60
Joined: May 19th, 2016, 6:48 am
Location: Belgium, Europe

Re: I heard you plan on doing a Minesweeper...

Post by Byteraver » February 28th, 2017, 7:50 pm

Aaah, minesweeper, the defacto exercise for a recursive function. When I first tried to make it some 20 years ago in Watcom C it blew up the stack, had to increase it :lol:

I believe the algorithm works fine. Why not make a graphical version? Some minor remarks:
- since I use azerty, I had to change the keys. Better use the cursor keys to navigate, enter to open, space to mark. For example. Or better still, mouse driven.
- When you uncover a cell with nothing in it (not even a number), it should automatically uncover *all* 8 squares around it. It doesn't do that right now.
- when you flag a square, you should not be able to "open" it until you unflag it. Otherwise there's no point in flagging it ;)
- when you hit a bomb, the program stops. Better tell the player he lost, let him look at the disaster and wait for a keypress :)

But the game works, good job I'd say.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: I heard you plan on doing a Minesweeper...

Post by chili » March 1st, 2017, 1:14 am

Shit, I had taken time to look over some of the blood offerings last night, but I totally missed this one! I'll have to peruse your creation over lunch. Just peeking at the code, it's super easy to follow, well done! I'd say you're doing it right.

As for improvements, it seems byte has given a pretty comprehensive list. I'll add some if any come to mind. You can check out my T23 if you wanna see my take of the minesweeper (Memesweeper) genre. :)
Chili

TheTask1337
Posts: 21
Joined: October 30th, 2014, 9:10 pm

Re: I heard you plan on doing a Minesweeper...

Post by TheTask1337 » March 1st, 2017, 9:33 pm

Hi guys, thank you for showing interest!

Yeah, I didn't assume someone would be using a different layout, sorry. I love doing simple programs in console ( I also did a Snake clone purely in console, similar to this, but the refresh rate of console is terrible and it flickers a lot, I am afraid someone would with epilepsy would be affected ). I was thinking of using something like a SFML or Chili's framework, but this for me is a purity :D

Oh, I didn't know that you have to unflag a square in order to uncover it. And I thought I new the rules of that game.

And finally, if you "Run without debugging", the program will write: You have lost the game. I am prone to use system( "PAUSE ) or std::cin.getline(), so I just left it like that.



EDIT: By the way Chili, I have been following you since 2014 and I have seen every single video of yours, love them!

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: I heard you plan on doing a Minesweeper...

Post by chili » March 2nd, 2017, 6:54 am

So I took a look at the minesweeper. Like I said, the code looks pretty good; easy to follow. The width didn't match my console windows and so all the damn lines weren't aligned. Might be cuz im running from remote desktop, ill try again later at home.

IF you wanna make a proper console game (roguelike etc.), you should look into the console API for windows. It's not super complicated and it will let you access the console text buffer directly, and use colors. Give it a shot!

Edit:

Looks like you are indeed using win console ops for some things. You should use it for all your output of the board, adding colors and shit.
Chili

Post Reply