-
Notifications
You must be signed in to change notification settings - Fork 9
/
tournament.py
83 lines (73 loc) · 4.11 KB
/
tournament.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
no_of_stalls = [2, 3, 20, 30, 100]
no_of_obstacles = [0, 50, 200]
players = ['1 2 3 4 5 6',
'1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6',
'1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 ',
'1 1 1 1 1 1',
'2 2 2 2 2 2',
'3 3 3 3 3 3',
'4 4 4 4 4 4',
'5 5 5 5 5 5',
'6 6 6 6 6 6',
'1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1',
'2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2',
'3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3',
'4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4',
'5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5',
'6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6',
'1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1',
'2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2',
'3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3',
'4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4',
'5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5',
'6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6']
theta = [1, 2]
with open('tournament_1.sh', 'w') as f:
f.write('start=$(date +%s)\n')
with open('tournament_2.sh', 'w') as f:
f.write('start=$(date +%s)\n')
with open('tournament_3.sh', 'w') as f:
f.write('start=$(date +%s)\n')
total = len(no_of_stalls) * len(no_of_obstacles) * len(players) * len(theta)
count = 0
for p in players:
for nv in no_of_stalls:
for no in no_of_obstacles:
for t in theta:
count += 1
with open('tournament_1.sh', 'a') as f:
f.write('echo -e "\n\nRun ' + str(count) + '/' + str(total) + '\n"' + '\n')
f.write('echo -e "\n\nRun ' + str(count) + '/' + str(total) + '\n" >> tournament_results_1.txt' + '\n')
f.write('python3 main.py --gui False -ns ' + str(nv + no) + ' -nv ' + str(nv) + ' -p ' + str(p) + ' --theta ' + str(t) + " --seed 5\n")
f.write('cat logs/game_config.txt >> tournament_results.txt\n')
f.write('cat logs/result.txt >> tournament_results.txt\n')
count = 0
for p in players:
for nv in no_of_stalls:
for no in no_of_obstacles:
for t in theta:
count += 1
with open('tournament_2.sh', 'a') as f:
f.write('echo -e "\n\nRun ' + str(count) + '/' + str(total) + '\n"' + '\n')
f.write('echo -e "\n\nRun ' + str(count) + '/' + str(total) + '\n" >> tournament_results_2.txt' + '\n')
f.write('python3 main.py --gui False -ns ' + str(nv + no) + ' -nv ' + str(nv) + ' -p ' + str(p) + ' --theta ' + str(t) + " --seed 2\n")
f.write('cat logs/game_config.txt >> tournament_results.txt\n')
f.write('cat logs/result.txt >> tournament_results.txt\n')
count = 0
for p in players:
for nv in no_of_stalls:
for no in no_of_obstacles:
for t in theta:
count += 1
with open('tournament_3.sh', 'a') as f:
f.write('echo -e "\n\nRun ' + str(count) + '/' + str(total) + '\n"' + '\n')
f.write('echo -e "\n\nRun ' + str(count) + '/' + str(total) + '\n" >> tournament_results_3.txt' + '\n')
f.write('python3 main.py --gui False -ns ' + str(nv + no) + ' -nv ' + str(nv) + ' -p ' + str(p) + ' --theta ' + str(t) + " --seed 3\n")
f.write('cat logs/game_config.txt >> tournament_results.txt\n')
f.write('cat logs/result.txt >> tournament_results.txt\n')
with open('tournament_1.sh', 'a') as f:
f.write('end=$(date +%s)\necho "Elapsed Time: $(($end-$start)) seconds" >> time.txt')
with open('tournament_2.sh', 'a') as f:
f.write('end=$(date +%s)\necho "Elapsed Time: $(($end-$start)) seconds" >> time.txt')
with open('tournament_3.sh', 'a') as f:
f.write('end=$(date +%s)\necho "Elapsed Time: $(($end-$start)) seconds" >> time.txt')