Skip to content

Commit 208c6e0

Browse files
authored
Update conways_game_of_life.py
1 parent aebda9f commit 208c6e0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cellular_automata/conways_game_of_life.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def new_generation(cells: list[list[int]]) -> list[list[int]]:
3030
cells[x][y] for x in range(i - 1, i + 2) for y in range(j - 1, j + 2)
3131
if 0 <= x < len(cells) and 0 <= y < len(row) and (x != i or y != j)
3232
)
33-
next_gen[i][j] = 1 if cell == 1 and 2 <= neighbours <= 3 or cell == 0 \
34-
and neighbours == 3 else 0
33+
next_gen[i][j] = 1 if cell == 1 and 2 <= neighbours <= 3 or cell == 0 and neighbours == 3 else 0
3534
return next_gen
3635

3736
def generate_images(cells: list[list[int]], frames: int) -> list[Image.Image]:

0 commit comments

Comments
 (0)