Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Minesweeper Need Help Creating
Closed Thread
Old 03-30-2004, 12:04 PM   #1 (permalink)
 
True Techie

Join Date: Mar 2004

Posts: 119

Legion2005

Send a message via AIM to Legion2005
Default Minesweeper Need Help Creating

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.
__________________
My PC Specs

Asus K8N
AMD64 2800+
1024 MB RAM PC-3200
GeForce FX 5700 128 MB
80 Gig 7200 RPM Hard Drive
DVD Burner
56k Modem (OH YEAH!!)
8 Channel Onboard Sound
5.1 Logitech Surround Sound
KDS Xtreme Flat Screen Monitor 17in.
Logitech Cordless Mouse
Running my long awated watercooling. Double radiator setup. 3 120mm fans right now. Finishing case.....
Legion2005 is offline  
Old 04-11-2004, 12:04 AM   #2 (permalink)
 
Junior Techie

Join Date: Mar 2004

Posts: 56

raylu

Send a message via AIM to raylu
Default

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.
__________________
\"Only when the last tree is dead, the last field paved, and the last river dammed, only then will we realize that we can\'t eat money.\"
http://raylu.uni.cc
raylu is offline  
Old 04-12-2004, 09:06 PM   #3 (permalink)
 
Junior Techie

Join Date: Feb 2004

Posts: 66

whiteknight

Default

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.
__________________
<a href=\"http://www.caldera.com\">litigious *******s</a>
whiteknight is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On