Created
May 1, 2019 17:59
-
-
Save terakun/77be08b7471359d6bebc2cffe446a58f to your computer and use it in GitHub Desktop.
QuoridorのPythonクライアントのテンプレート
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
port = 8080 | |
ip = '127.0.0.1' | |
# サーバ/ポートを指定 | |
s.connect((ip, port)) | |
while True: | |
mesg = s.recv(1024) # メッセージを受信 (https://github.com/terakun/quoridor_judgeの入力形式に対応するバイト列が送られてくる) | |
print(mesg) | |
# ここでAIが次の手を計算する | |
op = 'next operation' | |
s.sendall(op.encode) # 手を送信 (https://github.com/terakun/quoridor_judgeの出力形式に対応するバイト列を送る) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment