當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。