我喜欢Conway的生命游戏,并开始尝试用python编写它.此刻我还没有为程序的边界编写任何代码,所以我只是在寻求现在的帮助.在初始化"闪光灯"形成时我似乎遇到了麻烦.它似乎将自己变成了一个立方体,而不是像它应该的那样摆动.
#File: gameoflife.py
#Description: This is a basic "life" simulation that follows three distinct rules:
#1.Any live cell with fewer than two live neighbours dies
#2.Any live cell with two or three live neighbours lives
#3.Any live cell with more than three live neighbours dies
#4.Any dead cell with exactly three live neighbours becomes a live cell
#A neighbor is deemed as any cell directly horizantal/vertical/diagonal
#meaning there are 9 neighbors to a cell at any time
from graphics import …Run Code Online (Sandbox Code Playgroud)