Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2047
Number of posts: 5331

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Edit Report
Minesweeper source code? Posted by Kelsrick on 11 Nov 2000 at 10:29 AM
I'm trying to analyze how this game works, but all the code I found so far for the game have graphics and mouse support which makes things for me "unreadable". Would appreciate if anyone can give me the code which is a TEXT based game.


Edit Report
Re: Minesweeper source code? Posted by Unknown on 26 Nov 2000 at 3:01 PM
The program is simple, what you have is a grid of cells. Each cell is a bomb, or a numeric value. Everytime a bomb is placed is a location, 1 is added to all the surrounding cells:<br>
<br>
000<br>
000<br>
000<br>
<br>
BECOMES<br>
<br>
111<br>
1*1<br>
111<br>
<br>
IN A BIGGER PICTURE:<br>
<br>
00111000<br>
112*1000<br>
1*211000<br>
11100000<br>
<br>
So what you have to do is:<br>
<br>
1.) Make a 2d array of type CELL<br>
--CELL is a record with the following values:<br>
*BOMB - Boolean (IS IT A BOMB?)<br>
*VALUE - Integer (HOW MANY BOMBS SURROUND THIS POINT?)<br>
*ACTIVE - Boolean (Must it be shown?[Clicked on etc...])<br>
<br>
2.) Make a filter, which adds 1 to all the CELLS surrounding the BOMB. Make sure it doesn't try to add outside of the grid.<br>
<br>
This sets up you grid of CELLS. From then on it is quite simple!<br>
<br>
Hope this helps u, im sorry I wrote a program in pascal exactly like this but it is at school!<br>
<br>
Sorry,<br>
Cheers,<br>
--DarkMore





 

Recent Jobs