File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
src/adventofcode/year_2015 Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ from typing import List
2+
3+ from adventofcode .util .exceptions import SolutionNotFoundException
4+ from adventofcode .util .helpers import solution_timer
5+ from adventofcode .util .input_helpers import get_input_for_day
6+
7+ mul = 252533
8+ mod = 33554393
9+
10+
11+ def get_next_code (current_code : int , coords : tuple [int , int ]) -> int :
12+ x , y = 1 , 1
13+ want_x , want_y = coords
14+
15+ while True :
16+ if y == 1 :
17+ y = x + 1
18+ x = 1
19+ else :
20+ y -= 1
21+ x += 1
22+
23+ current_code = (current_code * mul ) % mod
24+
25+ if x == want_x and y == want_y :
26+ return current_code
27+
28+
29+ @solution_timer (2015 , 25 , 1 )
30+ def part_one (_ : List [str ]):
31+ row = 2978
32+ column = 3083
33+ answer = get_next_code (20151125 , (column , row ))
34+
35+ if not answer :
36+ raise SolutionNotFoundException (2015 , 25 , 1 )
37+
38+ return answer
39+
40+
41+ @solution_timer (2015 , 25 , 2 )
42+ def part_two (input_data : List [str ]):
43+ answer = 'hooray'
44+
45+ if not answer :
46+ raise SolutionNotFoundException (2015 , 25 , 2 )
47+
48+ return answer
49+
50+
51+ if __name__ == '__main__' :
52+ data = get_input_for_day (2015 , 25 )
53+ part_one (data )
54+ part_two (data )
You can’t perform that action at this time.
0 commit comments