def test_am_i_alive(self):
     self.testboard = gologic.board(13)
     self.testboard.grid[(3,3)] = gologic.stone(0,2)
     self.testgroup = gologic.group((3,3),0,self.testboard.grid)
     assert self.testgroup.am_i_alive(self.testboard.grid) == True, "group should have more than 0 liberties"
     
     self.testboard.grid[(0,0)] = gologic.stone(0,2) 
     self.testgroup2 = gologic.group((0,0),0,self.testboard.grid)
     self.testboard.grid[(1,0)] = gologic.stone(1,2)
     self.testboard.grid[(0,1)] = gologic.stone(1,3)
     assert self.testgroup2.am_i_alive(self.testboard.grid) == False, "group should have 0 liberties"
     
     self.testboard.grid[(10,10)] = gologic.stone(0,2)
     self.testgroup3 = gologic.group((10,10),0,self.testboard.grid)
     self.testboard.grid[(11,10)] = gologic.stone(1,2)
     self.testboard.grid[(9,10)] = gologic.stone(1,3)
     self.testboard.grid[(10,11)] = gologic.stone(1,4)
     self.testboard.grid[(10,9)] = gologic.stone(1,5)
     assert self.testgroup3.am_i_alive(self.testboard.grid) == False, "group should have 0 liberties"
Exemple #2
0
 def test_bad_stone_order(self):
     with self.assertRaises(gologic.bad_stone_order_error):
         self.teststone = gologic.stone(0,-2)
Exemple #3
0
 def test_new_stone(self):
     self.teststone = gologic.stone(0,15)
     assert self.teststone.colour == 0
     assert self.teststone.order == 15