예제 #1
0
 def test_get_neighbours_for_lower_right_corner(self):
     game = GameOfLife(width=self.width, height=self.height, cell_size=1)
     game.grid = self.grid
     neighbours = game.get_neighbours((5, 7))
     self.assertEqual(3, len(neighbours))
     self.assertEqual(1, sum(neighbours))
예제 #2
0
 def test_get_neighbours_for_right_side(self):
     game = GameOfLife(width=self.width, height=self.height, cell_size=1)
     game.grid = self.grid
     neighbours = game.get_neighbours((2, 7))
     self.assertEqual(5, len(neighbours))
     self.assertEqual(2, sum(neighbours))
예제 #3
0
 def test_get_neighbours(self):
     game = GameOfLife(width=self.width, height=self.height, cell_size=1)
     game.grid = self.grid
     neighbours = game.get_neighbours((2, 3))
     self.assertEqual(8, len(neighbours))
     self.assertEqual(4, sum(neighbours))