コード例 #1
0
def main():
    world = World(
        Grid(3, [[False, False, False], [True, True, True],
                 [False, False, False]]))
    for i in range(100):
        world.tick()
    for event in world.history:
        for row in event.display():
            print(" ".join(row))
        print("\n")
コード例 #2
0
ファイル: test_game.py プロジェクト: jonodrew/gol-2018
 def test_tick_with_three_grid_with_horizontal_bar(self, three_grid_with_horizontal_bar):
     w = World(three_grid_with_horizontal_bar)
     w.tick()
     assert w.history[0] == three_grid_with_horizontal_bar
     expected_future = [
         [Cell(False), Cell(True), Cell(False)],
         [Cell(False), Cell(True), Cell(False)],
         [Cell(False), Cell(True), Cell(False)]
     ]
     for y in range(2):
         for x in range(2):
             assert w.now.diagram[y][x].alive == expected_future[y][x].alive