Closed ideonaut closed 2 years ago
Which demo is this? I don't think we have a Conway's Life demo.
That's embarrassing! I got it from https://simplegametutorials.github.io/pygamezero/life/ , which I thought was part of the Pygame Zero site... Guess not!
I'll go bother them now.
The existing Life program on the site gets weird when things reach the edges. To get traditional toroidal wrapping, I suggest:
# lines removed: # and (y + dy) < len(grid) # and (x + dx) < len(grid[y + dy]) # and grid[y + dy][x + dx]):
Of course the new variables ny and nx aren't really necessary, but they helped me figure out the fix and may make it more readable.