def test_eye_recursion(self): # a checkerboard pattern of black is 'technically' all true eyes # mutually supporting each other gs = GameState(size=7) for x in range(gs.get_size()): for y in range(gs.get_size()): if (x + y) % 2 == 1: gs.do_move((x, y), color=go.BLACK) self.assertTrue(gs.is_eye((0, 0), go.BLACK))
def test_hash_update_matches_actual_hash(self): gs = GameState(size=7) gs, moves = parseboard.parse("a x b . . . .|" "z c d . . . .|" ". . . . . . .|" ". . . y . . .|" ". . . . . . .|" ". . . . . . .|" ". . . . . . .|") # a,b,c,d are black, x,y,z,x are white move_order = ['a', 'x', 'b', 'y', 'c', 'z', 'd', 'x'] for m in move_order: move_1d = flatten_idx(moves[m], gs.get_size()) # 'Try' move and get hash with gs.try_stone(move_1d): hash1 = gs.get_hash() # Actually do move and get hash gs.do_move(moves[m]) hash2 = gs.get_hash() self.assertEqual(hash1, hash2)