Game of Life

posted by: Ms. Martin 28 March 2011 No Comment

Create a class which extends Actor and simulates a cell in Conway’s Game of Life.

As the Wikipedia article states, at each step in time, the following transitions occur:

  1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overcrowding.
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

I recommend implementing two methods: one to figure out what the next steps need to be and another to execute those actions. ¬†All births and deaths across the world need to happen at the same time so you’ll have to make sure that all cells are planning their next steps at the same time and all are doing what they need to do at the same time.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>