def test_ayane5(self): print("test_ayane5 : ") server = ayane.AyaneruServer() for engine in server.engines: engine.set_engine_options({"Hash":"128","Threads":"1","NetworkDelay":"0","NetworkDelay2":"0","MaxMovesToDraw":"320" \ , "MinimumThinkingTime":"0"}) #engine.debug_print = True engine.connect("exe/YaneuraOu.exe") # 持ち時間設定。 server.set_time_setting("byoyomi 100") # 1手0.1秒 # server.set_time_setting("time 1000 inc 2000") # 1秒 + 1手2秒 # これで対局が開始する server.game_start() # 対局が終了するのを待つ while not server.game_result.is_gameover(): time.sleep(1) # 対局棋譜の出力 print("game sfen = " + server.sfen) print("game_result = " + str(server.game_result)) server.terminate()
# 勝ち,負け,引き分けの結果を示す定数 WIN = 0 DRAW = 1 LOSE = 2 # Ayaneにおける結果をここでの結果に変換する辞書 result_converter = { ayane.GameResult.BLACK_WIN: WIN, ayane.GameResult.WHITE_WIN: LOSE, ayane.GameResult.DRAW: DRAW, ayane.GameResult.MAX_MOVES: DRAW } # インスタンス生成 server = ayane.AyaneruServer() # サーバの設定 server.error_print = True server.set_time_setting(f"byoyomi1p {args.time1} byoyomi2p {args.time2}") server.moves_to_draw = 320 # YaneuraOuの設定 server.engines[1].set_engine_options({ "USI_Ponder": "false", "NodesLimit": args.NodesLimit, "USI_Hash": hash_size, "BookMoves": 0, "NetworkDelay": 0, "NetworkDelay2": 0 })