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


Python gtp.Engine方法代码示例

本文整理汇总了Python中gtp.Engine方法的典型用法代码示例。如果您正苦于以下问题:Python gtp.Engine方法的具体用法?Python gtp.Engine怎么用?Python gtp.Engine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gtp的用法示例。


在下文中一共展示了gtp.Engine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_gtp_instance

# 需要导入模块: import gtp [as 别名]
# 或者: from gtp import Engine [as 别名]
def make_gtp_instance(read_file, readouts_per_move=2000, verbosity=1, cgos_mode=False):
    n = DualNetwork(read_file)
    instance = MCTSPlayer(n, simulations_per_move=readouts_per_move,
                          verbosity=verbosity, two_player_mode=True)
    gtp_engine = gtp.Engine(instance)
    if cgos_mode:
        instance = CGOSPlayer(n, seconds_per_move=5,
                              verbosity=verbosity, two_player_mode=True)
    else:
        instance = MCTSPlayer(n, simulations_per_move=readouts_per_move,
                              verbosity=verbosity, two_player_mode=True)
    name = "Somebot-" + os.path.basename(read_file)
    gtp_engine = gtp_extensions.GTPDeluxe(instance, name=name)
    return gtp_engine 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:16,代码来源:gtp_wrapper.py

示例2: make_gtp_instance

# 需要导入模块: import gtp [as 别名]
# 或者: from gtp import Engine [as 别名]
def make_gtp_instance(strategy_name, read_file):
    n = PolicyNetwork(use_cpu=True)
    n.initialize_variables(read_file)
    if strategy_name == 'random':
        instance = RandomPlayer()
    elif strategy_name == 'policy':
        instance = GreedyPolicyPlayer(n)
    elif strategy_name == 'randompolicy':
        instance = RandomPolicyPlayer(n)
    elif strategy_name == 'mcts':
        instance = MCTSPlayer(n)
    else:
        return None
    gtp_engine = gtp.Engine(instance)
    return gtp_engine 
开发者ID:llSourcell,项目名称:alphago_demo,代码行数:17,代码来源:gtp_wrapper.py

示例3: make_gtp_instance

# 需要导入模块: import gtp [as 别名]
# 或者: from gtp import Engine [as 别名]
def make_gtp_instance(board_size, read_file, readouts_per_move=100,
                      verbosity=1, cgos_mode=False):
  n = DualNetRunner(read_file)
  instance = MCTSPlayer(board_size, n, simulations_per_move=readouts_per_move,
                        verbosity=verbosity, two_player_mode=True)
  gtp_engine = gtp.Engine(instance)
  if cgos_mode:
    instance = CGOSPlayer(board_size, n, seconds_per_move=5,
                          verbosity=verbosity, two_player_mode=True)
  else:
    instance = MCTSPlayer(board_size, n, simulations_per_move=readouts_per_move,
                          verbosity=verbosity, two_player_mode=True)
  name = 'Somebot-' + os.path.basename(read_file)
  gtp_engine = gtp_extensions.GTPDeluxe(instance, name=name)
  return gtp_engine 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:17,代码来源:gtp_wrapper.py

示例4: setUp

# 需要导入模块: import gtp [as 别名]
# 或者: from gtp import Engine [as 别名]
def setUp(self):
        self.engine = Engine(MinimalGame()) 
开发者ID:jtauber,项目名称:gtp,代码行数:4,代码来源:test.py

示例5: setUp

# 需要导入模块: import gtp [as 别名]
# 或者: from gtp import Engine [as 别名]
def setUp(self):
        model = DummyModel()
        self.gtp_engine = Engine(model, 'test.log') 
开发者ID:Narsil,项目名称:alphagozero,代码行数:5,代码来源:tests.py

示例6: gtp

# 需要导入模块: import gtp [as 别名]
# 或者: from gtp import Engine [as 别名]
def gtp(strategy, read_file=None):
    n = PolicyNetwork(use_cpu=True)
    if strategy == 'random':
        instance = RandomPlayer()
    elif strategy == 'policy':
        instance = PolicyNetworkBestMovePlayer(n, read_file)
    elif strategy == 'randompolicy':
        instance = PolicyNetworkRandomMovePlayer(n, read_file)
    elif strategy == 'mcts':
        instance = MCTS(n, read_file)
    else:
        sys.stderr.write("Unknown strategy")
        sys.exit()
    gtp_engine = gtp_lib.Engine(instance)
    sys.stderr.write("GTP engine ready\n")
    sys.stderr.flush()
    while not gtp_engine.disconnect:
        inpt = input()
        # handle either single lines at a time
        # or multiple commands separated by '\n'
        try:
            cmd_list = inpt.split("\n")
        except:
            cmd_list = [inpt]
        for cmd in cmd_list:
            engine_reply = gtp_engine.send(cmd)
            sys.stdout.write(engine_reply)
            sys.stdout.flush() 
开发者ID:brilee,项目名称:MuGo,代码行数:30,代码来源:main.py


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