-
Notifications
You must be signed in to change notification settings - Fork 0
/
solver.py
executable file
·54 lines (40 loc) · 1.26 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
from interface import ask_question
from bomb import Bomb
import modules
def solve_bomb():
module_names = list(modules.solvers.keys())
print("<ctrl>+c to finish the bomb")
bomb = Bomb()
while True:
print("--------------------------------------------------")
print()
for i, name in enumerate(module_names):
print("{}. {}".format(i, name))
sel_num = ask_question("Which module are we defusing now?", int)
selection = module_names[sel_num]
try:
modules.solvers[selection](bomb)
except KeyboardInterrupt:
print()
continue
def print_header():
print()
print(" ====================================")
print(" # Joe's amazing KTANE expert #")
print(" # #")
print(" # Manual verification code: #")
print(" # 241 #")
print(" ====================================")
print()
def main():
print_header()
try:
solve_bomb()
except KeyboardInterrupt:
print()
print("Well done (presumably)")
print("Exiting...")
print_header()
if __name__ == "__main__":
main()