Cellular automata 2d from Shiffman to wolfram

hi… i am studying cellular automata…
Starting from shiffman’s book, nature of code, i made a Cellular automata in two dimension.

it follow the rules of the wolfram book,new kind of science, and so i set up a system based on a cell with four Neighbors.

the system runs without complications, but only in few case i have the same output, or similar, to the image of the wolfram book. For the rest the behavior of the system is very interesting but strange.

I attached all src file so if one have interest in it, searching to understand why there is this behavior and correct it in accord to the wolfram book.

Ca2d.zip (3.4 KB)




I’m running this file through visual studio 2012 & am getting the following error:

Run-Time Check Failure #2 - Stack around the variable ‘rule’ was corrupted.

The program seems to run for a few seconds, then this pops up…Any idea why “rule” is becoming corrupt?


Most of the images from wolframs book are based on 1D CA, so you start with 1 square, then generate the next line below, then the next etc…your code seems to be more along the line of Conway’s game of life…

fot the first question, i don’t know. i built it in Code Blocks and it run, also i tried it in Xcode on mac machine and it go. i think that it is a problem of visual studio (maybe).

for the second question, Yes, i built the Ca 2d on the model of conway’s game.
Few days ago i found this link
Ca2d openprocessing it is based on conway’s game but it implement the 2d Ca and it solve the problems of the rules.