I like writing the Game of Life as a helloworld program when learning graphics libraries because the naive algorithm is very easy to implement. It is however pretty slow. I want to try writing something more efficient than doing a whole pass through the board each frame, so I wonder which "fast" algorithm is more or less easy to understand and implement?

you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 8 months ago* (2 children)

Rather than parsing the whole board, keep a hashset or list of all the cells that are live. Then apply the rules to all of those cells and their neighbours. Should avoid needlessly checking dead cells.

  • source
  • hideshow 2 child comments