View Full Version : Game of Life
Zelwyn
December 7th, 2005, 06:23 PM
I'm getting ready to start a Game of Life (http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) project in Flash, but first before I do, does anyone know how to take a grid, and check if one square is touching others, and how many?
i.e.
O.O
.O.
OO.
I know that the center is touching 4 other cells, but how do I get AS to realize that?
Hoping for help, cause I'm lazy.
senocular
December 7th, 2005, 06:31 PM
Check out... iieeee... were-here? I think were-here. We did a game of life competition a few years ago and there were a bunch of sources and different approaches. Most interesting was seeing how optimized people got because of the resources needed to handle the grid size used (and this might have been so far back as Flash 5).
I'd suggest having each place be an object that contains 5 values, the first being its own on or off flag and the 4 others being references to each of the 4 adjacent tiles. Then to check on any one tile, you wont have to worry about finding the other tiles since you already have references to them.
mike_mike
January 16th, 2010, 08:49 PM
Hi there, I created a similar kind game of life a few months ago.
I never could really complete the project but pushed it pretty far.
Check at a demo on my blog and download the full source code if it's of some interest for you.
http://wordpress.mikeland.us/2010/01/13/vida2d-game-of-life-w-flash-as3-box2d-2/
Hope you enjoy!
Mike
Sirisian
January 17th, 2010, 10:09 PM
mike_mike, that isn't the game of life that you made. When people say "the game of life" they are talking about cellular automaton.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.