示例#1
0
 def test_simple_update2(self):
     init_config = [(0, 0), (0, 1), (0, 2)]
     board = Board(3)
     board.set_alive_cells(init_config)
     board.update()
     states = board.list_of_values
     self.assertListEqual(states, [
         [0, 1, 0],
         [0, 1, 0],
         [0, 0, 0]
     ])
示例#2
0
 def test_overpopulation(self):
     init_config = [(0, 1), (1, 0), (1, 1), (1, 2), (2, 1)]
     board = Board(3)
     board.set_alive_cells(init_config)
     board.update()
     states = board.list_of_values
     self.assertListEqual(states, [
         [1, 1, 1],
         [1, 0, 1],
         [1, 1, 1]
     ])
示例#3
0
 def test_simple_update(self):
     alive_cells = [(0, 0), (1, 1), (0, 1)]
     board = Board(3)
     board.set_alive_cells(alive_cells)
     board.update()
     states = board.list_of_values
     self.assertListEqual(states, [
         [1, 1, 0],
         [1, 1, 0],
         [0, 0, 0]
     ])