You are browsing as a guest. Sign up (or log in) to start making projects!

2h 35m 52s logged

I got the rules working! This was probably the hardest part yet, honestly.

  • First, the function to count the live neighbors of a cell took an embarrassingly long amount of time. After a bunch of iterations, I settled on looping through a list of tuples representing offsets for the x and y “coordinates” of the cell. I had to check for the bounds, too, since there are cells on the edges and it will fail if I count those as neighbors too.
  • The function to actually run the simulation, or making a cell live or die based on the rules, was less hard. I implemented the rules fairly quickly from the Wikipedia page on the game, though the wording was kind of tricky. There was this bug early on where the cells would glitch out and not update correctly, and I was able to fix it by creating a copy of the grid and changing that instead, then “pushing” it to the screen all at once.

Overall, I think the project is turning out nicely. Next, I will implement a pause feature so that I can draw stuff and see how it plays out instead of hardcoding it for testing.

0
2

Comments 0

No comments yet. Be the first!