-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.py
More file actions
49 lines (34 loc) · 898 Bytes
/
engine.py
File metadata and controls
49 lines (34 loc) · 898 Bytes
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
values = {
'r' : 1,
'p' : 2,
's' : 3
}
def compare( file1, file2, path ):
actions1 = []
actions2 = []
f1 = path + file1 + '.py'
f2 = path + file2 + '.py'
print f1
exec1 = {}
execfile( f1, exec1 )
f1 = exec1['rps']
print f2
exec2 = {}
execfile( f2, exec2 )
f2 = exec2['rps']
for i in range(1000):
value1 = f1( actions1, actions2 )
value2 = f2( actions2, actions1 )
## print value1, '-', value2
actions1.append( value1.lower() )
actions2.append( value2.lower() )
results = []
for first, second in zip( actions1, actions2 ):
result = values[ first ] - values[ second ]
if result > 0:
results.append( file1 )
if result < 0:
results.append( file2 )
if result == 0:
results.append( 'tie' )
return results