diff --git a/cellular_automaton/automaton.py b/cellular_automaton/automaton.py index 2bc8eac..83eb6e6 100644 --- a/cellular_automaton/automaton.py +++ b/cellular_automaton/automaton.py @@ -54,8 +54,9 @@ class CellularAutomatonCreator(abc.ABC): def __make_cells(self): for coord in itertools.product(*[range(d) for d in self._dimension]): - self._current_state[coord] = CELL(self.init_cell_state(coord)) - self._next_state[coord] = CELL(self.init_cell_state(coord)) + cell_state = self.init_cell_state(coord) + self._current_state[coord] = CELL(cell_state) + self._next_state[coord] = CELL(cell_state) def __add_neighbors(self): calculate_neighbor_coordinates = self._neighborhood.calculate_cell_neighbor_coordinates