forked from keyjoke/vs-kangaroo-hybrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolver.py
40 lines (36 loc) · 960 Bytes
/
solver.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
#!/usr/bin/python
import sys
def main():
A, Ak, B, Bk = [], [], [], []
with open('tame.txt','r') as f:
for line in f:
if len(line) == 130:
L = line.split()
a = int(L[0],16)
b = int(L[1],16)
A.append(a)
Ak.append(b)
with open('wild.txt','r') as f:
for line in f:
if len(line) == 130:
L = line.split()
a = int(L[0],16)
b = int(L[1],16)
B.append(a)
Bk.append(b)
result = list(set(A) & set(B))
if len(result) > 0:
sol_kt = A.index(result[0])
sol_kw = B.index(result[0])
d = Ak[sol_kt] - Bk[sol_kw]
print ('\n' + '\n' + 'SOLVED: ' + hex(d) + '\n')
file = open("Result.txt",'a')
file.write("---------------\n")
file.write(hex(Ak[sol_kt] - Bk[sol_kw]) + "\n")
file.write("---------------\n")
file.close()
sys.exit(0)
else:
sys.exit(1)
if __name__== "__main__":
main()