Skip to content

fix grid x/y access #2953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading