Code for cellular automata in c#: