Skip to content

Commit 8c1f2a5

Browse files
authored
Merge pull request #2953 from FoamyGuy/custom_led_animation_fixes
fix grid x/y access
2 parents 027433f + bfa39be commit 8c1f2a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Custom_LED_Animations/conways/conways.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _is_grid_empty(self):
8484
"""
8585
for y in range(self.height):
8686
for x in range(self.width):
87-
if not _is_pixel_off(self.pixel_grid[x, y]):
87+
if not _is_pixel_off(self.pixel_grid[x][y]):
8888
return False
8989

9090
return True
@@ -109,7 +109,7 @@ def _count_neighbors(self, cell):
109109
for direction in ConwaysLifeAnimation.DIRECTION_OFFSETS:
110110
try:
111111
if not _is_pixel_off(
112-
self.pixel_grid[cell[0] + direction[0], cell[1] + direction[1]]
112+
self.pixel_grid[cell[0] + direction[0]][cell[1] + direction[1]]
113113
):
114114
neighbors += 1
115115
except IndexError:
@@ -140,7 +140,7 @@ def draw(self):
140140
for x in range(self.width):
141141

142142
# check and set the current cell type, live or dead
143-
if _is_pixel_off(self.pixel_grid[x, y]):
143+
if _is_pixel_off(self.pixel_grid[x][y]):
144144
cur_cell_type = ConwaysLifeAnimation.DEAD
145145
else:
146146
cur_cell_type = ConwaysLifeAnimation.LIVE

0 commit comments

Comments
 (0)