Minesweeper Need Help Creating

Status
Not open for further replies.

Legion2005

In Runtime
Messages
119
For school I have to make a minesweeper, and I am not a very good programmer... I am more into hardware. Could someone give me some tips on how to place mines in a field that consists of picBoxes? I have 64 picBoxes from index 0 to 63. I have to randomly place 10 mines in the field. I have no idea on where to start, and would really appreciate any help.
 
Make command buttons, I guess. Have them pretty small. You could have a random number between 0 and 63 generated 10 times (loop). Then, change the names of the buttons like this:
Code:
cmd35.Name = mine1 `35 is row 3, column 5
And then in mine1_click(), execute the lose code.

I'm not a very good programmer either and there are probably better ways.
 
Thats probably one of the better ways to do it. You would use a random number generator to generate 2 numbers 10 times. The 2 numbers it generates would be the cordinates for the 10 mines. You would then change the name or store there names as a variable. You would then calculate how many mines each button is by. When the user clicks on it the txt is changed to the txt of how many mines are near by. You coudl use similar code for if you select when where there are 0 mines all the nearby boxes dissapear.
 
Status
Not open for further replies.
Back
Top Bottom