Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def play_game(bots):
- cmd = f'java -jar cg-brutaltester.jar -r "java -jar GreenCircle.jar" -p1 "./bots/{bots[0]}" -p2 "./bots/{bots[1]}" -t 1 -n 1'
- task = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
- output = task.stdout.decode('UTF-8').split('\n')
- print(cmd)
- for line in output[-10:]:
- print(line)
- p1_won = ' 100.00% ' in output[-6]
- p2_won = ' 100.00% ' in output[-4]
- p1_lost = ' 0.00% ' in output[-6]
- p2_lost = ' 0.00% ' in output[-4]
- print(p1_won, p2_won)
- assert (p1_won != p1_lost) and (p2_won != p2_lost)
- if p1_won:
- return [0, 1]
- elif p2_won:
- return [1, 0]
- else:
- return [0, 0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement