![]() |
|
#1
|
|||
|
|||
Quick Basic and Game of LifeI'm pretty new to programming but I think that i could program the Game of Life, in it's simplest way. I've already programmed 1 dimensional cellular automata in quick basic, and now I would like to try to program conway's game of life. I think that it'll be best to start with a finite space.
I know that I should do it with a pair of two-dimensional arrays, one for the old generation and one for the new, and then set the newgen array to be the old one, and set the new gen to 0. But I have problems with the loop and algorythm which should compare a cell with its neighbours in order to predict the new gen... Can somebody help, please? The best way would be if somebody could write the algorythm in pseudocode... thank you very much... -XXX- |
|||
|
#2
|
|||
|
|||
Re: quick basic and Game of lifeQuote:
Code:
Regards, Dave |
|
#3
|
|||
|
|||
Re: quick basic and Game of lifeYes, thank you very much, it was very helpful.
|
|
#4
|
|||
|
|||
Re: quick basic and Game of lifeQuote:
I didn't define this correctly. The condition is that we examine the cells in the range defined by Code:
In other words don't include the cell array(r,c) in the count (we are counting the neighbors of array(r,c)): (row not equal to r) OR (col not equal to c) More precisely: Code:
Regards, Dave |
|
#5
|
|||
|
|||
Re: quick basic and Game of lifeFirstly here is my code, in QuickBasic.
Code:
Comments are preceeded by a " ' " and are in blue. PSET(y,x),col sets a pixel in the given color col. The problem is that it doesn't do what a normal glider should do but draw lines from one side of the frame to another... Help, please? -XXX- |
|
#6
|
|||
|
|||
Re: quick basic and Game of lifeQuote:
No way am I going to figure out the QBasic (I'm not even going to look at it), but: Shouldn't you erase the old picture before drawing the new picture at each generation? (PSET the old array points to the background color or some such thing?) Regards, Dave Last edited by davekw7x : 05-Apr-2007 at 10:28.
|
|
#7
|
||||
|
||||
Re: quick basic and Game of lifeYour code looks OK, as far as I checked it. The problem is your concept of the arrays.
Rather than dealing with pixels, use characters. Define oldgen and newgen to be the size of the screen and just output "*" for each 1 and SPACE for each 0. This will help you get the concept down. Once that's done, then you can try the pixel thing. And Dave is correct. You have to erase the old screen when using the pixels. __________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
|
#8
|
|||
|
|||
Re: quick basic and Game of lifeQuote:
Well, I couldn't resist a little peek (An old BASIC pun. Get it? PEEK? No? Oh, well...) What's up with this? Code:
Code:
Regards, Dave |
|
#9
|
|||
|
|||
Re: quick basic and Game of lifes**t am I stupid!!
Thank You very much, really !! works as it should now.... thx, -XXX- |
|
#10
|
|||
|
|||
Re: quick basic and Game of lifeQuote:
Having a program of your very own to use to investigate the possibilities is waaaay better than just running someone else's java (or whatever...) on some web site somewhere (but there are lots of good ideas out there). Regards, Dave |
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Computer Game Design HELP NEEDED! | dcallito | C++ Forum | 3 | 01-Jun-2007 12:29 |
| HELP!!!!HELP!!!! Design a game call “Games of Guessing” HELP!!!! | tianurn | C++ Forum | 1 | 26-Mar-2007 15:38 |
| Help on Basic Design C++ | maliquenavidad | C++ Forum | 4 | 28-Nov-2005 21:24 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The