Question

does anybody know how to create next generation in game of life knowing only where are living cells , i mean their coordinates (so that an algorithm was linear with number of living cells)? Thanks a lot.

Était-ce utile?

La solution

The Wikipedia page goes into full detail of all the possible algorithms. Although there is a "basic" one, there isn't just one; in fact, the very idea that one can create varying, interesting patterns by switching up the algorithm is what makes The Game of Life so intriguing to most people.

The only thing you need to understand is to check your cells for change before actually changing them, so that they are all read first and then changed second. You need to understand how to store this data temporarily as a sort of "scrap paper" concept. Other than that, it's just a matter of counting adjacent cells and acting however you please.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top