[Minesweeper Need Help Creating] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



Minesweeper Need Help Creating

(Click here to view the original thread with full colors/images)



Posted by: Legion2005

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.



Posted by: raylu

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[/code]
And then in mine1_click(), execute the lose code.

I'm not a very good programmer either and there are probably better ways.



Posted by: whiteknight

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.





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon