当前位置: 首页>>代码示例>>Python>>正文


Python Analyzer.sd_limit方法代码示例

本文整理汇总了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)))
开发者ID:flatline,项目名称:Lopez,代码行数:36,代码来源:AnalyzerTests.py

示例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)
开发者ID:flatline,项目名称:Lopez,代码行数:52,代码来源:AnalyzerTests.py


注:本文中的Analyzer.Analyzer.sd_limit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。