one dimensional cellular automaton implemented in scala