Cellular Automaton in AngularJS