2019-04-09
阅读量:
619
python实现康威的生命游戏(2)
- 如果单元格为ON且少于两个ON的邻居,则它将关闭
- 如果一个单元是ON并且有两个或三个ON的邻居,它将保持为ON。
- 如果单元格为ON并且有三个以上的邻居处于ON状态,则它将关闭。
- 如果一个单元格处于OFF状态并且正好有三个相邻的ON,则它将变为ON。
因为我们知道它是如何工作的,接下来我们需要弄清楚如何使其工作。
途径:
1. Initialize the cells in the grid.
2. At each time step in the simulation, for each
cell (i, j) in the grid, do the following:
a. Update the value of cell (i, j) based on
its neighbors, taking into account the
boundary conditions.
b. Update the display of grid values.






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论