Skip to content

Instantly share code, notes, and snippets.

@steve806
Last active August 18, 2018 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steve806/d368d7007523bd576f38e84f644ac7a1 to your computer and use it in GitHub Desktop.
Save steve806/d368d7007523bd576f38e84f644ac7a1 to your computer and use it in GitHub Desktop.
# -'- 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