示例#1
0
文件: test_cell.py 项目: nbbn/minespy
 def test_calculate_neighbours(self):
     b = Board(5, 3)
     b._mapa = [[100, -1, -1, -1, -2], [-2, -1, 100, -1, -1], [-2, -1, -1, -1, 0]]
     c = Cell(column=0, row=0, board=b)
     assert_equal(c.calculate_neighbours(),2)
     assert_equal(c.neighbours, 2)
     c = Cell(column=0, row=2, board=b)
     assert_equal(c.calculate_neighbours(),2)
     assert_equal(c.neighbours, 2)
     c = Cell(column=2, row=1, board=b)
     assert_equal(c.calculate_neighbours(),8)
     assert_equal(c.neighbours, 8)
     c = Cell(column=4, row=0, board=b)
     assert_equal(c.calculate_neighbours(),3)
     assert_equal(c.neighbours, 3)
示例#2
0
文件: test_cell.py 项目: nbbn/minespy
 def test_calculate_neighbours(self):
     b = Board(5, 3)
     b._mapa = [[100, -1, -1, -1, -2], [-2, -1, 100, -1, -1],
                [-2, -1, -1, -1, 0]]
     c = Cell(column=0, row=0, board=b)
     assert_equal(c.calculate_neighbours(), 2)
     assert_equal(c.neighbours, 2)
     c = Cell(column=0, row=2, board=b)
     assert_equal(c.calculate_neighbours(), 2)
     assert_equal(c.neighbours, 2)
     c = Cell(column=2, row=1, board=b)
     assert_equal(c.calculate_neighbours(), 8)
     assert_equal(c.neighbours, 8)
     c = Cell(column=4, row=0, board=b)
     assert_equal(c.calculate_neighbours(), 3)
     assert_equal(c.neighbours, 3)