예제 #1
0
 def test_eye_recursion(self):
     # a checkerboard pattern of black is 'technically' all true eyes
     # mutually supporting each other
     gs = GameState(7)
     for x in range(gs.size):
         for y in range(gs.size):
             if (x + y) % 2 == 1:
                 gs.do_move((x, y), go.BLACK)
     self.assertTrue(gs.is_eye((0, 0), go.BLACK))
예제 #2
0
    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))