-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpart_b.py
executable file
·37 lines (29 loc) · 875 Bytes
/
part_b.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
#!/usr/bin/env python3
import utils
from year_2019.day_21.part_a import SpringScript, run_spring_robot
class Challenge(utils.BaseChallenge):
def solve(self, _input, debug=False):
"""
>>> Challenge().default_solve()
1139206699
"""
return run_spring_robot(get_extended_script(), _input, running=True)
def get_extended_script():
"""
>>> script = get_extended_script()
>>> script.simulate("#####.###########", True)
>>> script.simulate("#####.##.##..####", True)
>>> script.simulate("#####.#.#...#####", True)
"""
return SpringScript()\
.not_('A', 'J')\
.not_('C', 'T')\
.or_('T', 'J')\
.not_('B', 'T')\
.or_('T', 'J')\
.and_('D', 'J')\
.set_('E', 'T')\
.or_('H', 'T')\
.and_('T', 'J')
Challenge.main()
challenge = Challenge()