initial working code for cell_automata