Advertisement

CA and Life..

Started by July 31, 2002 12:57 PM
7 comments, last by laeuchli 22 years, 6 months ago
Dear All, I was thinking it might be fun to mess around with CA, and decided I start with writing conways game of life. My question is this. A cell dies if it has more then 4 cells next to it, and dies if it has less then 2. A empty cell comes to life when it has 4 cells around it. As I transverse the grid, do I update the grid after everchange, and so giving early cells a chance to effect laters ones, or do I only update after all the cells have been evaluated? Jesse www.laeuchli.com/jesse/
I''d evaluate each cell first then update the ''map''.

I have a recollection of evaluation and updating at the same time, and I think it killed off the sample fairly quickly on heavily populated maps.

But this is like 20 years ago, so I could be talking through a hole in my head.


D.V.

Carpe Diem
D.V.Carpe Diem
Advertisement
One pass to update to a separate storage area, then a second to copy that back over the first. As far as I know this is the only way that Conway''s Life is done, although certainly other rule sets may develop better when done in one pass.
I''ve been writing a game of life program to help me learn opengl. A dead cell comes to life if 3 surrounding cells are alive (not 4), and a cell stays alive in the next generation if 2 or 3 of the surrounding cells are alive (otherwise it dies from over- or under- crowding.

What I have done is create 2 separate grids, say 50x50 cells, for each cell on the first grid work out how many of the surrounding cells are alive, then decide if the cell stays alive, dies or becomes alive. Then you put this cells information into the second grid, this becomes part of the next generation, when you have processed all your cells in the original grid you need to copy those cells back to the 1st grid to overwrite the old generation, you then process the 1st gird again putting the new cell information into the 2nd grid, copy to the 1st grid and keep going.


hope this helps.

Ian
Hey all,
Thanks, for the help. It''s working nicly now. Just one more question. Is the grid supposed to be treated as wraparound or not? Thanks,
Jesse
www.laeuchli.com/jesse/
I think you should do it wrap around.

Normally the game of life should play on an infinite grid, but that''s of course impossible on a computer. But if you wrap around it''s already "more infinite" than if you don''t. There aren''t supposed to be sides in game of life.
Advertisement
IMHO, wraparound is better. Without it you get non-Life results at the boundaries - i.e. the corner cell has only three neighbors so is affected differently by the rule-set.
... I once saw the Game of Life presented in 3D. The wrapping of top-bottom and left-right edges actually creates a torus. This person (and my apologies, it was a long time ago, so I cannot recall who or where I saw it) programmed a 3D model of a torus with the Game of Life as an evolving texture mapped onto its surface! It was one damn funky dohnut! You could rotate it about two axes, one up the middle and one, like a skewer, through opposite sides of the ring.

Cheers,

Timkin
I don''t know if anyone has seen this excellent cellular automata site:

http://www.collidoscope.com/modernca/welcome.html

My final year project at university was the simulation of dendritic crystal growth using cellular automata - this guy has got a few examples which look a lot like the kind of thing that I came up with. Of course, it all ran a LOT slower in those days.

This topic is closed to new replies.

Advertisement