-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
51 lines (49 loc) · 1.85 KB
/
main.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
from main import Antikythera, Rotor
# This puzzle is made of a number of rotors, each having columns of numbers radiating out from the center.
# Each rotor has an equal number of columns. Columns are represented as a List[Optional[int]]. Columns may have 'holes' or be missing entirely.
# The index of the Dict[int, List[Optional[int]]] below represents the position of the column.
# 'None' in this object represents a column with a hole in it, i.e. that the number needs to be read from the rotor below this one.
# Rotors are added from the top down.
# The objective of the puzzle is to rotate the rotors until each column adds up to 42.
ant = Antikythera(5, 4, 12, 42)
ant.add_rotor(Rotor({0: [15, None, 8, None, 3, None, 6, None, 10, None, 7, None]}))
ant.add_rotor(
Rotor(
{
0: [6, 17, 7, 3, None, 6, None, 11, 11, 6, 11, None],
1: [12, None, 4, None, 7, 15, None, None, 14, None, 9, None],
}
)
)
ant.add_rotor(
Rotor(
{
0: [8, 9, 13, 9, 7, 13, 21, 17, 4, 5, None, 7],
1: [None, 21, 6, 15, 4, 9, 18, 11, 26, 14, 1, 12],
2: [None, 5, None, 10, None, 8, None, 22, None, 16, None, 9],
}
)
)
ant.add_rotor(
Rotor(
{
0: [7, None, 9, None, 7, 14, 11, None, 8, None, 16, None],
1: [9, None, 2, 3, 6, None, 14, 12, 9, None, 9, 2],
2: [3, 26, 6, None, 2, 13, 9, None, 17, 19, 3, 12],
3: [1, None, 9, None, 12, None, 6, None, 10, None, 10, None],
}
)
)
ant.add_rotor(
Rotor(
{
0: [14, 11, 14, 14, 11, 14, 11, 14, 11, 11, 14, 11],
1: [8, 9, 10, 11, 12, 13, 14, 15, 4, 5, 6, 7],
2: [3, 3, 14, 14, 21, 21, 9, 9, 4, 4, 6, 6],
3: [2, 5, 10, 7, 16, 8, 7, 8, 8, 3, 4, 12],
}
)
)
print(f"\n{ant.to_str()}")
input("Press ENTER to continue\n")
ant.solve()