Skip to content

Commit f4f5e26

Browse files
committed
feat(2022): refactor days 10-12
Refactored Days 10, 11, and 12 of 2022 to use the common framework. Fixed multiple issues, including incorrect parser calls, borrow checker errors, and improper function calls in the Monkey simulation. Solutions are now verified and integrated.
1 parent 3067215 commit f4f5e26

10 files changed

Lines changed: 641 additions & 9 deletions

File tree

2022/inputs/10/prod.txt

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
noop
2+
noop
3+
noop
4+
addx 5
5+
noop
6+
addx 1
7+
addx 2
8+
addx 5
9+
addx 2
10+
addx 1
11+
noop
12+
addx 5
13+
noop
14+
addx -1
15+
noop
16+
addx 5
17+
noop
18+
noop
19+
addx 5
20+
addx 1
21+
noop
22+
noop
23+
addx 3
24+
addx 2
25+
noop
26+
addx -38
27+
noop
28+
addx 3
29+
addx 2
30+
addx -5
31+
addx 12
32+
addx 2
33+
addx 27
34+
addx -40
35+
addx 19
36+
addx 2
37+
addx 19
38+
addx -18
39+
addx 2
40+
addx 5
41+
addx 2
42+
addx -23
43+
addx 22
44+
addx 4
45+
addx -34
46+
addx -1
47+
addx 5
48+
noop
49+
addx 2
50+
addx 1
51+
addx 20
52+
addx -17
53+
noop
54+
addx 25
55+
addx -17
56+
addx -2
57+
noop
58+
addx 3
59+
addx 19
60+
addx -12
61+
addx 3
62+
addx -2
63+
addx 3
64+
addx 1
65+
noop
66+
addx 5
67+
noop
68+
noop
69+
addx -37
70+
addx 3
71+
addx 4
72+
noop
73+
addx 24
74+
addx -6
75+
addx -15
76+
addx 2
77+
noop
78+
addx 6
79+
addx -2
80+
addx 6
81+
addx -12
82+
addx -2
83+
addx 19
84+
noop
85+
noop
86+
noop
87+
addx 3
88+
noop
89+
addx 7
90+
addx -2
91+
addx -24
92+
addx -11
93+
addx 4
94+
addx 3
95+
addx -2
96+
noop
97+
addx 7
98+
addx -2
99+
addx 2
100+
noop
101+
addx 3
102+
addx 7
103+
noop
104+
addx -2
105+
addx 5
106+
addx 2
107+
addx 5
108+
noop
109+
noop
110+
noop
111+
addx 3
112+
addx -35
113+
addx 35
114+
addx -21
115+
addx -14
116+
noop
117+
addx 5
118+
addx 2
119+
addx 33
120+
addx -7
121+
addx -23
122+
addx 5
123+
addx 2
124+
addx 1
125+
noop
126+
noop
127+
addx 5
128+
addx -1
129+
noop
130+
addx 3
131+
addx -23
132+
addx 30
133+
addx 1
134+
noop
135+
addx 4
136+
addx -17
137+
addx 11
138+
noop
139+
noop

2022/inputs/10/test.txt

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
addx 15
2+
addx -11
3+
addx 6
4+
addx -3
5+
addx 5
6+
addx -1
7+
addx -8
8+
addx 13
9+
addx 4
10+
noop
11+
addx -1
12+
addx 5
13+
addx -1
14+
addx 5
15+
addx -1
16+
addx 5
17+
addx -1
18+
addx 5
19+
addx -1
20+
addx -35
21+
addx 1
22+
addx 24
23+
addx -19
24+
addx 1
25+
addx 16
26+
addx -11
27+
noop
28+
noop
29+
addx 21
30+
addx -15
31+
noop
32+
noop
33+
addx -3
34+
addx 9
35+
addx 1
36+
addx -3
37+
addx 8
38+
addx 1
39+
addx 5
40+
noop
41+
noop
42+
noop
43+
noop
44+
noop
45+
addx -36
46+
noop
47+
addx 1
48+
addx 7
49+
noop
50+
noop
51+
noop
52+
addx 2
53+
addx 6
54+
noop
55+
noop
56+
noop
57+
noop
58+
noop
59+
addx 1
60+
noop
61+
noop
62+
addx 7
63+
addx 1
64+
noop
65+
addx -13
66+
addx 13
67+
addx 7
68+
noop
69+
addx 1
70+
addx -33
71+
noop
72+
noop
73+
noop
74+
addx 2
75+
noop
76+
noop
77+
noop
78+
addx 8
79+
noop
80+
addx -1
81+
addx 2
82+
addx 1
83+
noop
84+
addx 17
85+
addx -9
86+
addx 1
87+
addx 1
88+
addx -3
89+
addx 11
90+
noop
91+
noop
92+
addx 1
93+
noop
94+
addx 1
95+
noop
96+
noop
97+
addx -13
98+
addx -19
99+
addx 1
100+
addx 3
101+
addx 26
102+
addx -30
103+
addx 12
104+
addx -1
105+
addx 3
106+
addx 1
107+
noop
108+
noop
109+
noop
110+
addx -9
111+
addx 18
112+
addx 1
113+
addx 2
114+
noop
115+
noop
116+
addx 9
117+
noop
118+
noop
119+
noop
120+
addx -1
121+
addx 2
122+
addx -37
123+
addx 1
124+
addx 3
125+
noop
126+
addx 15
127+
addx -21
128+
addx 22
129+
addx -6
130+
addx 1
131+
noop
132+
addx 2
133+
addx 1
134+
noop
135+
addx -10
136+
noop
137+
noop
138+
addx 20
139+
addx 1
140+
addx 2
141+
addx 2
142+
addx -6
143+
addx -11
144+
noop
145+
noop
146+
noop

2022/inputs/11/prod.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Monkey 0:
2+
Starting items: 64
3+
Operation: new = old * 7
4+
Test: divisible by 13
5+
If true: throw to monkey 1
6+
If false: throw to monkey 3
7+
8+
Monkey 1:
9+
Starting items: 60, 84, 84, 65
10+
Operation: new = old + 7
11+
Test: divisible by 19
12+
If true: throw to monkey 2
13+
If false: throw to monkey 7
14+
15+
Monkey 2:
16+
Starting items: 52, 67, 74, 88, 51, 61
17+
Operation: new = old * 3
18+
Test: divisible by 5
19+
If true: throw to monkey 5
20+
If false: throw to monkey 7
21+
22+
Monkey 3:
23+
Starting items: 67, 72
24+
Operation: new = old + 3
25+
Test: divisible by 2
26+
If true: throw to monkey 1
27+
If false: throw to monkey 2
28+
29+
Monkey 4:
30+
Starting items: 80, 79, 58, 77, 68, 74, 98, 64
31+
Operation: new = old * old
32+
Test: divisible by 17
33+
If true: throw to monkey 6
34+
If false: throw to monkey 0
35+
36+
Monkey 5:
37+
Starting items: 62, 53, 61, 89, 86
38+
Operation: new = old + 8
39+
Test: divisible by 11
40+
If true: throw to monkey 4
41+
If false: throw to monkey 6
42+
43+
Monkey 6:
44+
Starting items: 86, 89, 82
45+
Operation: new = old + 2
46+
Test: divisible by 7
47+
If true: throw to monkey 3
48+
If false: throw to monkey 0
49+
50+
Monkey 7:
51+
Starting items: 92, 81, 70, 96, 69, 84, 83
52+
Operation: new = old + 4
53+
Test: divisible by 3
54+
If true: throw to monkey 4
55+
If false: throw to monkey 5

2022/inputs/11/test.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Monkey 0:
2+
Starting items: 79, 98
3+
Operation: new = old * 19
4+
Test: divisible by 23
5+
If true: throw to monkey 2
6+
If false: throw to monkey 3
7+
8+
Monkey 1:
9+
Starting items: 54, 65, 75, 74
10+
Operation: new = old + 6
11+
Test: divisible by 19
12+
If true: throw to monkey 2
13+
If false: throw to monkey 0
14+
15+
Monkey 2:
16+
Starting items: 79, 60, 97
17+
Operation: new = old * old
18+
Test: divisible by 13
19+
If true: throw to monkey 1
20+
If false: throw to monkey 3
21+
22+
Monkey 3:
23+
Starting items: 74
24+
Operation: new = old + 3
25+
Test: divisible by 17
26+
If true: throw to monkey 0
27+
If false: throw to monkey 1

0 commit comments

Comments
 (0)