-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbatch.py
More file actions
50 lines (44 loc) · 1.11 KB
/
batch.py
File metadata and controls
50 lines (44 loc) · 1.11 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
44
45
46
47
48
49
50
# pip install matplotlib
# pip install numpy
import os
import re
from pylab import *
import numpy
times = 20
w_scores = []
b_scores = []
for i in range(0, times):
f = os.popen("swipl -O -q -s main.pl")
for l in f.readlines():
if l.startswith("White: "):
w_scores.append(float(re.split('\s', l)[1]))
elif l.startswith("Black: "):
b_scores.append(float(re.split('\s', l)[1]))
print "White AVG: "
print numpy.mean(w_scores)
print "Median: "
print numpy.median(w_scores)
print "25th percentile: "
print numpy.percentile(w_scores, 25)
print "75th percentile: "
print numpy.percentile(w_scores, 75)
print "Variance: "
print numpy.var(w_scores)
print " "
print "Black AVG: "
print numpy.mean(b_scores)
print "Median: "
print numpy.median(b_scores)
print "25th percentile: "
print numpy.percentile(b_scores, 25)
print "75th percentile: "
print numpy.percentile(b_scores, 75)
print "Variance: "
print numpy.var(b_scores)
print " "
figure()
plot(range(0, times), w_scores, '#cccccc', label="White")
plot(range(0, times), b_scores, '#000000', label="Black")
xlabel("plays")
ylabel("score")
show()