-
Notifications
You must be signed in to change notification settings - Fork 0
/
PitchEvent.py
48 lines (35 loc) · 865 Bytes
/
PitchEvent.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
import random
import os
GENERATE = 0
def genQuadrantEvents(n=1000):
i = 0
QuadrantEvents = []
while i < n:
QuadrantEvents += [random.randint(0,9)]
i += 1
return QuadrantEvents
swings = []
pitches = []
if GENERATE:
pitches = genQuadrantEvents()
swings = genQuadrantEvents()
file = open("pitch.loc", "w+")
file.write(str(PitchEventLocations)+"\n")
file.close()
file = open("swing.loc", "w+")
file.write(str(SwingEventLocations)+"\n")
file.close()
file = open("pitch.loc", "r")
pitches = file.readline()
file.close()
pitches = eval(pitches)
file = open("swing.loc", "r")
swings = file.readline()
file.close()
swings = eval(swings)
#cnt = 0
for i in range(len(pitches)):
if pitches[i] == swings[i]:
#print "hit %d\n" % pitches[i]
# cnt += 1
#print "%d matches\n" % cnt