Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matsjoyce-refeyn committed Oct 29, 2024
1 parent a9978f3 commit 82264f0
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions examples/conway.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,16 @@ def tick(self) -> None:
self._buffer, (y_shift, x_shift), (0, 1)
)
for i, rule in enumerate(self._rule):
match rule:
case self.CellTransition.BORN_AND_SURVIVE:
self._buffer[self._neighbour_counts == i] = True
case self.CellTransition.BORN:
self._buffer[self._neighbour_counts == i] = ~self._buffer[
self._neighbour_counts == i
]
case self.CellTransition.SURVIVE:
pass
case self.CellTransition.DIE:
self._buffer[self._neighbour_counts == i] = False
if rule == self.CellTransition.BORN_AND_SURVIVE:
self._buffer[self._neighbour_counts == i] = True
elif rule == self.CellTransition.BORN:
self._buffer[self._neighbour_counts == i] = ~self._buffer[
self._neighbour_counts == i
]
elif rule == self.CellTransition.SURVIVE:
pass
elif rule == self.CellTransition.DIE:
self._buffer[self._neighbour_counts == i] = False
self._history_buffer *= 95
self._history_buffer //= 100
self._history_buffer[self._buffer] = 1000
Expand Down

0 comments on commit 82264f0

Please sign in to comment.