コード例 #1
0
def quickdraw(f, depth):
    for line in f:
        line = line.strip()
        print(line)

        pos = xboard.parseFEN(line)
        for d in range(depth, 99):
            s0 = sunfish.bound(pos, 0, d)
            s1 = sunfish.bound(pos, 1, d)
            if s0 >= 0 and s1 < 1:
                break
            print(d, s0, s1, xboard.pv(0, pos))
        else:
            print("Fail: Unable to find draw!")
            return
コード例 #2
0
ファイル: test.py プロジェクト: NikAlexSer/sunfish
def quickdraw(f, depth):
    for line in f:
        line = line.strip()
        print(line)

        pos = xboard.parseFEN(line)
        for d in range(depth, 99):
            s0 = sunfish.bound(pos, 0, d)
            s1 = sunfish.bound(pos, 1, d)
            if s0 >= 0 and s1 < 1:
                break
            print(d, s0, s1, xboard.pv(0, pos))
        else:
            print("Fail: Unable to find draw!")
            return
コード例 #3
0
ファイル: test.py プロジェクト: Athul-Biju/sunfish
def quickmate(path, depth):
    """ Similar to allmate, but uses the `bound` function directly to only
    search for moves that will win us the game """
    with open(path) as f:
        for line in f:
            line = line.strip()
            print(line)

            pos = xboard.parseFEN(line)
            for d in range(depth, 99):
                score = sunfish.bound(pos, sunfish.MATE_VALUE, d)
                if score >= sunfish.MATE_VALUE:
                    break
                print(d, score)
            else:
                print("Unable to find mate. Only got score = %d" % score)
                return
コード例 #4
0
def quickmate(path, depth):
    """ Similar to allmate, but uses the `bound` function directly to only
    search for moves that will win us the game """
    with open(path) as f:
        for line in f:
            line = line.strip()
            print(line)

            pos = xboard.parseFEN(line)
            for d in range(depth, 99):
                score = sunfish.bound(pos, sunfish.MATE_VALUE, d)
                if score >= sunfish.MATE_VALUE:
                    break
                print(d, score)
            else:
                print("Unable to find mate. Only got score = %d" % score)
                return
コード例 #5
0
def quickmate(f, min_depth=1, draw=False):
    """ Similar to allmate, but uses the `bound` function directly to only
    search for moves that will win us the game """
    if draw:
        return quickdraw(f, min_depth)

    for line in f:
        line = line.strip()
        print(line)

        pos = xboard.parseFEN(line)
        for d in range(min_depth, 99):
            score = sunfish.bound(pos, sunfish.MATE_VALUE, d)
            if score >= sunfish.MATE_VALUE:
                break
            print('Score at depth {}: {}'.format(d, score))
        else:
            print("Unable to find mate. Only got score = %d" % score)
            return
コード例 #6
0
ファイル: test.py プロジェクト: NikAlexSer/sunfish
def quickmate(f, min_depth=1, draw=False):
    """ Similar to allmate, but uses the `bound` function directly to only
    search for moves that will win us the game """
    if draw:
        return quickdraw(f, min_depth)

    for line in f:
        line = line.strip()
        print(line)

        pos = xboard.parseFEN(line)
        for d in range(min_depth, 99):
            score = sunfish.bound(pos, sunfish.MATE_VALUE, d)
            if score >= sunfish.MATE_VALUE:
                break
            print('Score at depth {}: {}'.format(d, score))
        else:
            print("Unable to find mate. Only got score = %d" % score)
            return