def test_true_eye(self): gs = GameState(size=7) gs.do_move((1, 0), go.BLACK) gs.do_move((0, 1), go.BLACK) # false eye at 0, 0 self.assertTrue(gs.is_eyeish((0, 0), go.BLACK)) self.assertFalse(gs.is_eye((0, 0), go.BLACK)) # make it a true eye by turning the corner (1, 1) into an eye itself gs.do_move((1, 2), go.BLACK) gs.do_move((2, 1), go.BLACK) gs.do_move((2, 2), go.BLACK) gs.do_move((0, 2), go.BLACK) self.assertTrue(gs.is_eyeish((0, 0), go.BLACK)) self.assertTrue(gs.is_eye((0, 0), go.BLACK)) self.assertTrue(gs.is_eye((1, 1), go.BLACK))
def test_true_eye(self): gs = GameState(size=7) gs.do_move((1, 0), go.BLACK) gs.do_move((0, 1), go.BLACK) # false eye at 0,0 self.assertTrue(gs.is_eyeish((0, 0), go.BLACK)) self.assertFalse(gs.is_eye((0, 0), go.BLACK)) # make it a true eye by turning the corner (1,1) into an eye itself gs.do_move((1, 2), go.BLACK) gs.do_move((2, 1), go.BLACK) gs.do_move((2, 2), go.BLACK) gs.do_move((0, 2), go.BLACK) self.assertTrue(gs.is_eyeish((0, 0), go.BLACK)) self.assertTrue(gs.is_eye((0, 0), go.BLACK)) self.assertTrue(gs.is_eye((1, 1), go.BLACK))
def test_simple_eye(self): # create a black eye in top left (1, 1), white in bottom right (5, 5) gs = GameState(size=7) gs.do_move((1, 0)) # B gs.do_move((5, 4)) # W gs.do_move((2, 1)) # B gs.do_move((6, 5)) # W gs.do_move((1, 2)) # B gs.do_move((5, 6)) # W gs.do_move((0, 1)) # B gs.do_move((4, 5)) # W # test black eye top left self.assertTrue(gs.is_eyeish((1, 1), go.BLACK)) self.assertFalse(gs.is_eyeish((1, 1), go.WHITE)) # test white eye bottom right self.assertTrue(gs.is_eyeish((5, 5), go.WHITE)) self.assertFalse(gs.is_eyeish((5, 5), go.BLACK)) # test no eye in other random positions self.assertFalse(gs.is_eyeish((1, 0), go.BLACK)) self.assertFalse(gs.is_eyeish((1, 0), go.WHITE)) self.assertFalse(gs.is_eyeish((2, 2), go.BLACK)) self.assertFalse(gs.is_eyeish((2, 2), go.WHITE))
def test_simple_eye(self): # create a black eye in top left (1,1), white in bottom right (5,5) gs = GameState(size=7) gs.do_move((1, 0)) # B gs.do_move((5, 4)) # W gs.do_move((2, 1)) # B gs.do_move((6, 5)) # W gs.do_move((1, 2)) # B gs.do_move((5, 6)) # W gs.do_move((0, 1)) # B gs.do_move((4, 5)) # W # test black eye top left self.assertTrue(gs.is_eyeish((1, 1), go.BLACK)) self.assertFalse(gs.is_eyeish((1, 1), go.WHITE)) # test white eye bottom right self.assertTrue(gs.is_eyeish((5, 5), go.WHITE)) self.assertFalse(gs.is_eyeish((5, 5), go.BLACK)) # test no eye in other random positions self.assertFalse(gs.is_eyeish((1, 0), go.BLACK)) self.assertFalse(gs.is_eyeish((1, 0), go.WHITE)) self.assertFalse(gs.is_eyeish((2, 2), go.BLACK)) self.assertFalse(gs.is_eyeish((2, 2), go.WHITE))