-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfaceoff.py
More file actions
44 lines (38 loc) · 1.19 KB
/
Copy pathfaceoff.py
File metadata and controls
44 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pickle
import random
import sys
import time
from dmstrat import *
from evol_strat import *
from rl_strat import *
try:
import torch
except ModuleNotFoundError:
print("Unable to find pytorch; deep RL methods unavailable.")
else:
from basic_polgrad import *
from ppo_strat import *
from nnmc_strat import *
# random.seed(123456)
def main_faceoff():
players = 2
strategies = []
for fname in sys.argv[1:]:
strategy = load_strategies(fname)[0]
strategy.learn = False
strategies.append(strategy)
CYCLES = 1
for cycle in range(CYCLES): # expect to Ctrl-C to exit early
if cycle == CYCLES-1: # last one
# Play final round without random exploratory moves
for strategy in strategies:
strategy.learn = False
start = time.time()
run_tournament(strategies, players, games_per_strategy=10000)
print(f"round {cycle} {players} players {time.time() - start:.2f} sec " + ("="*70))
for strategy in strategies:
print(strategy)
print("")
if __name__ == '__main__':
main_faceoff()
# import cProfile; cProfile.run("main_faceoff()", "profile.stats")