My minesweeper

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Zodac
Posts: 11
Joined: December 8th, 2016, 10:43 am

My minesweeper

Post by Zodac » February 21st, 2017, 2:48 pm

Last few days I've been working on a minesweeper game.
https://github.com/Sammy385/Minesweeper
That's the link to the GitHub repo. Feedback appreciated.

EDIT:
That repo's broken for some reason, this is the new one
https://github.com/Sammy385/Minesweeper_2


In the future I plan on:
1) making it so it opens nearby cells and shows how many nearby cells are bombs
2) giving it mouse input (at the moment everything is done with a keyboard)
3) making it object oriented (right now it's just a bunch of functions and variables)

How it's played:
You use the arrow keys to move the white box
Using CTRL switches between 3 states, Untouched, Safe and Suspected.
Untouched is self explanatory.
Safe marks a cell blue, it's for cells that you know are bombs and those can't be triggered.
Suspected does nothing at the moment, I plan on making it like "?" was in the original game.
Cells are opened by using SPACE, if a cell has no bombs it's marked green. If on the other hand it does have a bomb and you open it, all bomb cells are marked red and you can no longer move

PS.
I haven't made the bomb positions random just for some debugging reasons, I'll do that once I'm happy with everything else.
Last edited by Zodac on February 25th, 2017, 11:43 am, edited 2 times in total.

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

Re: My minesweeper

Post by chili » February 22nd, 2017, 2:14 pm

It looks good man. You really need those adjacency numbers there tho ;)

The code is very procedural. Nothing wrong with that I guess, esp. if you're not comfortable with OOP. If you wanna learn OOP though (which tends to scale much better than pure procedural when you get into the realm of large game systems), this would be a good opportunity to practice it.

When T23 pops (already recorded not edited yet) you can see how I handle it. I also show event-driven mouse input and solving for the adjacency numbers.

Thanks for sharing bro :)

P.S.

If nothing else, you need to stop doing this:

Code: Select all

for( ;; )
     for( ;; )
         code
Use the braces!!!
Chili

Zodac
Posts: 11
Joined: December 8th, 2016, 10:43 am

Re: My minesweeper

Post by Zodac » February 22nd, 2017, 2:47 pm

Yea I know I should stop doing that, I was getting confused with all the {} while working at 2 am and I forgot to put them back in place...

Zodac
Posts: 11
Joined: December 8th, 2016, 10:43 am

Re: My minesweeper

Post by Zodac » February 24th, 2017, 1:16 pm

Update on goal number 2. It's done, easier than I expected.

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

Re: My minesweeper

Post by chili » February 24th, 2017, 3:00 pm

Yeah, once you get the hang of mapping one space to another that stuff is a synch. Good job man.
Chili

Post Reply