new test setup

This commit is contained in:
Richard Feistenauer 2019-01-05 14:54:06 +01:00
parent b661d6e060
commit 93c78f0aa5
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ class TestRule(Rule):
cell.set_for_redraw() cell.set_for_redraw()
active = True active = True
elif len(neighbors) == 8: elif len(neighbors) == 8:
left_neighbour_state = neighbors[3].state.get_status_of_iteration(iteration_index - 1) left_neighbour_state = neighbors[0].state.get_status_of_iteration(iteration_index - 1)
active = cell.state.set_status_of_iteration(left_neighbour_state, iteration_index) active = cell.state.set_status_of_iteration(left_neighbour_state, iteration_index)
if active: if active:
cell.set_for_redraw() cell.set_for_redraw()
@ -42,6 +42,6 @@ class MyStatus(CellState):
if __name__ == "__main__": if __name__ == "__main__":
random.seed(1000) random.seed(1000)
rule = TestRule() rule = TestRule()
ca = CellularAutomaton([500, 500], MooreNeighborhood(EdgeRule.IGNORE_EDGE_CELLS), rule) ca = CellularAutomaton([400, 400], MooreNeighborhood(EdgeRule.FIRST_AND_LAST_CELL_OF_DIMENSION_ARE_NEIGHBORS), rule)
ca_window = PyGameFor2D([1000, 730], ca) ca_window = PyGameFor2D([1000, 800], ca)
ca_window.main_loop() ca_window.main_loop()

View File

@ -68,7 +68,7 @@ class PyGameFor2D:
while running: while running:
time_ca_start = time.time() time_ca_start = time.time()
self._cellular_automaton.evolve_x_times(1) self._cellular_automaton.evolve_x_times(5)
time_ca_end = time.time() time_ca_end = time.time()
self.ca_display._redraw_cellular_automaton() self.ca_display._redraw_cellular_automaton()
time_ds_end = time.time() time_ds_end = time.time()