-
-
Save steve806/d368d7007523bd576f38e84f644ac7a1 to your computer and use it in GitHub Desktop.
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
# -'- coding: utf-8 -*- | |
import sys | |
import subprocess | |
import json | |
from random import choice | |
def main(): | |
file_name = sys.argv[1] | |
# 예시 인풋 두 개 : 초기상태와 한칸씩 움직였을 때 | |
data_list = [{'map': 'A**************************************************************B', 'opponent_history': '', 'my_history': '', 'me': 'A', 'opponent': 'B'}, | |
{'map': 'aA************************************************************Bb', 'opponent_history': 'R', 'my_history': 'L', 'me': 'B', 'opponent': 'A'}] | |
data_str = json.dumps(choice(data_list)) | |
out = subprocess.check_output([sys.executable, file_name, data_str]).decode().strip() | |
direction = str(out) | |
right = ['U', 'D', 'R', 'L'] | |
if direction in right: | |
print("You choose {}".format(direction)) | |
else: | |
print("Wrong form") | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment