質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top