本文整理汇总了Python中Analyzer.Analyzer.sd_limit方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.sd_limit方法的具体用法?Python Analyzer.sd_limit怎么用?Python Analyzer.sd_limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.sd_limit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_capture
# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import sd_limit [as 别名]
def test_capture():
print("testing simple capture and advance")
print("\tsimple choice white")
b = Board()
b.board = [[0, 0, 0, 0, 0, 0, 0, -999],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 0],
[-1, 0, -3, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 999]]
a = Analyzer()
a.sd_limit = 2
res = a.minimax(b, 20)
assert(res.move == ((2, 1), (3, 2)))
print("\tsimple choice black")
b = Board()
b.turn = -1
b.board = [[0, 0, 0, 0, 0, 0, 0, 999],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 3, 0, 0, 0, 0, 0],
[0, -1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, -999]]
# a = Analyzer(20)
a.sd_limit = 2
res = a.minimax(b, 20)
assert(res.move == ((4, 1), (3, 2)))
示例2: test_scenarios
# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import sd_limit [as 别名]
def test_scenarios():
# some puzzles from Reinfeld's Chess Tactics for Beginners
print("testing move pruning")
a = Analyzer()
a.sd_limit = 4
print("\tPuzzle #21")
b = Board()
b.board = [[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, -1, 9, 0, 0, 0, 0, 0],
[0, 0, 0, 0, -999, -1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 999],
[0, 0, 0, 0, 0, 0, 0, -1],
[0, 0, 0, 0, 0, 0, 0, 0],
[-9, 0, 0, 0, 3, 0, 0, 0]]
res = a.minimax(b, 100)
print_move_chain(a, b, res)
assert(res.move == ((7,4),(5,3)))
# todo - pawn promotion is required for this one!
# print("\tPuzzle #23")
# b = Board()
# b.turn = -1
# b.board = [[0, 0, 0, 0, 0, 0, 0, 0],
# [0, 0, 999, 0, 0, 0, 0, -1],
# [-5, 0, 0, 0, 0, 0, 0, 0],
# [0, 0, 0, 0, 0, 0, 0, 0],
# [0, 0, 0, 0, 0, 0, 0, 0],
# [0, 0, 0, 0, 0, 0, 0, 0],
# [0, 0, 0, 0, 0, -999, 0, 0],
# [0, 0, 0, 0, 0, 0, 0, 5]]
# res = a.minimax(b)
# print_move_chain(b, res)
print("\tPuzzle 52")
b = Board()
b.turn = -1
b.board = [[0, 0, 5, 0, 0, 0, 999, 0],
[0, 0, 0, 0, 0, 1, 1, 1],
[1, 0, 0, -9, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[-1, -1, 0, 0, 0, 0, 0, -1],
[0, 0, 9, 0, 0, -1, -1, 0],
[0, 0, 0, -5, 0, 0, -999, 0]]
res = a.minimax(b, 100)
print_move_chain(a, b, res)