1. Home
  2. Computing & Technology
  3. C / C++ / C#
photo of David Bolton
David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

Programming Challenge 17 - Implement the Cellular Automaton known as Life.

Sunday August 17, 2008
Life - Cellular AutomatonThis isn't due until the end of October but as I thought of it the other day, I thought it best created before I forgot about it. Nearly 40 years ago a British mathematician John Horton Conway devised three simple rules which defined a cellular automaton that he called Life. It runs on a 2d grid with each point being clear or set. The rules determine what points are cleared (die) or are set (born) according to three simple rules.
  1. A set point surrounded by 2 or 3 other set points survives to the next generation.
  2. A set point dies if there are less than 2 other set points or more than 3 around it.
  3. A clear point becomes set if there are exactly three set points around it.
It's quite fascinating seeing the patterns arise before your eyes as each generation is processed. Some shapes (gliders) propel themselves across the grid as the animated image hopefully demonstrates. If not then you can view the original on Wikipedia.

Implementing it so that it runs fast is an interesting challenge. So this challenge is to create code that will implement Life according to those three rules and process a long lived shape of just five dots for 1,000 generations as quickly as possible. By the way, Challenge 15 hasn't had any entries yet!

Comments
August 17, 2008 at 11:22 pm
(1) Dennis Muhlestein says:

So which is it, Challenge 16 or 17? I believe you meant to say Challenge 16.

August 18, 2008 at 3:35 pm
(2) cplus says:

Me bad… d’oh! Now Fixed…

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.