This is code aims to provide a simple implementation of the Rule 110 Automata. It is also a personal excercise with the aim to learn Haskell, which means that the implementation will probably be not so good.
Rule 110 is a one of the 256 possible 1-dimensional cellular automata, made famous by Stephen Wolfram in his book `A New Kind of Science' and proven to be Turing Complete by Cook and Wolfram. You can find more information about it on Wikipedia and Wolfram Alpha;
Compile the code by running
make
then you can execute the binary as
./rule110 size step
where size is how many columns(i.e. cells) there will be and steps is the number of times the function program will be applied.
The output of the program is a simple image using the NetBPM P1 format, a simple image viewer like feh, eog or sxiv can open it or you can convert it to a png using ImageMagick. Each step is printed in the file, where the i-th step will be in the i+1th line, since the first one is the original state. The image will contain size columns and step+1 lines.