Advertisement
Guest User

Untitled

a guest
Jun 24th, 2022
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. def play_game(bots):
  2.     cmd = f'java -jar cg-brutaltester.jar -r "java -jar GreenCircle.jar" -p1 "./bots/{bots[0]}" -p2 "./bots/{bots[1]}" -t 1 -n 1'
  3.     task = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
  4.     output = task.stdout.decode('UTF-8').split('\n')
  5.     print(cmd)
  6.     for line in output[-10:]:
  7.         print(line)
  8.        
  9.     p1_won = ' 100.00% ' in output[-6]
  10.     p2_won = ' 100.00% ' in output[-4]
  11.     p1_lost = ' 0.00% ' in output[-6]
  12.     p2_lost = ' 0.00% ' in output[-4]
  13.     print(p1_won, p2_won)
  14.     assert (p1_won != p1_lost) and (p2_won != p2_lost)
  15.    
  16.     if p1_won:
  17.         return [0, 1]
  18.     elif p2_won:
  19.         return [1, 0]
  20.     else:
  21.         return [0, 0]
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement