Skip to content

Commit

Permalink
Merge pull request #2953 from FoamyGuy/custom_led_animation_fixes
Browse files Browse the repository at this point in the history
fix grid x/y access
  • Loading branch information
FoamyGuy authored Jan 23, 2025
2 parents 027433f + bfa39be commit 8c1f2a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Custom_LED_Animations/conways/conways.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _is_grid_empty(self):
"""
for y in range(self.height):
for x in range(self.width):
if not _is_pixel_off(self.pixel_grid[x, y]):
if not _is_pixel_off(self.pixel_grid[x][y]):
return False

return True
Expand All @@ -109,7 +109,7 @@ def _count_neighbors(self, cell):
for direction in ConwaysLifeAnimation.DIRECTION_OFFSETS:
try:
if not _is_pixel_off(
self.pixel_grid[cell[0] + direction[0], cell[1] + direction[1]]
self.pixel_grid[cell[0] + direction[0]][cell[1] + direction[1]]
):
neighbors += 1
except IndexError:
Expand Down Expand Up @@ -140,7 +140,7 @@ def draw(self):
for x in range(self.width):

# check and set the current cell type, live or dead
if _is_pixel_off(self.pixel_grid[x, y]):
if _is_pixel_off(self.pixel_grid[x][y]):
cur_cell_type = ConwaysLifeAnimation.DEAD
else:
cur_cell_type = ConwaysLifeAnimation.LIVE
Expand Down

0 comments on commit 8c1f2a5

Please sign in to comment.