相关疑难解决方法(0)

无限棋盘:康威的生命游戏 - Python

我被分配了这个项目,说明如下:

生命游戏是为无限大小的网格定义的。在第 2 章中,我们将 Life Grid ADT 定义为使用固定大小的网格,其中用户指定网格的宽度和高度。这足以说明如何使用二维数组来实现生命游戏。但完整的实现应该允许无限大小的网格。使用与实现稀疏矩阵类似的方法来实现稀疏生命网格 ADT。

老实说,我不太理解这个概念。您能否给我一个外行人可以理解的简短描述(如果不是简短的代码)?我会很感激。

稀疏生命网格.py

""" My initial GameOfLife code
    Feb 27, 2013
    Sparse Matrix code specially designed for Game of Life
"""
class SparseLifeGrid:

    def __init__(self):
        """
        "pass" just allows this to run w/o crashing.
        Replace it with your own code in each method.
        """
        pass 

    def minRange(self):
        """
        Return the minimum row & column as a list.
        """
        pass

    def maxRange(self):
        """
        Returns the maximum row & column as a list.
        """ …
Run Code Online (Sandbox Code Playgroud)

python conways-game-of-life

1
推荐指数
1
解决办法
6282
查看次数

标签 统计

conways-game-of-life ×1

python ×1