Conways Game of Life C#
Posted
by
Darren Young
on Programmers
See other posts from Programmers
or by Darren Young
Published on 2011-02-21T15:58:21Z
Indexed on
2011/02/23
23:33 UTC
Read the original article
Hit count: 358
Hi,
Not sure if this is the correct place for this question or SO - mods please move if necessary.
I am going to have a go at creating GoL over the weekend as a little test project : http://en.wikipedia.org/wiki/Conway's_Game_of_Life
I understand the algorithm, however I just wanted to check regarding the implementation, from maybe somebody that has tried it. Essentially, my first (basic) implementation, will be a static grid at a set speed.
If I understand correctly, these are the steps I will need:
- Initial seed
- Create 2d array with initial set up
- Foreach iteration, create temporary array, calculating each cells new state based on the Game of Life algorithm
- Assign temp array to proper array.
- Redraw grid from proper array.
My concerns are over speed. When I am populating the grid from the array, would it simply be a case of looping through the array, assigning on or off to each grid cell and then redraw the grid?
Am I on the correct path?
© Programmers or respective owner