Skip to content

Commit b4d7927

Browse files
committed
Split solutions into years
1 parent 01b940a commit b4d7927

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

src/main.rs

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use aoc::util::ansi::*;
22
use aoc::util::parse::*;
33
use aoc::*;
44
use std::env::args;
5+
use std::iter::empty;
56
use std::time::Instant;
67

78
fn main() {
@@ -16,8 +17,13 @@ fn main() {
1617
};
1718

1819
// Filter solutions
19-
let solutions: Vec<_> = all_solutions()
20-
.into_iter()
20+
let solutions: Vec<_> = empty()
21+
.chain(year2015())
22+
.chain(year2016())
23+
.chain(year2019())
24+
.chain(year2020())
25+
.chain(year2021())
26+
.chain(year2022())
2127
.filter(|solution| year == Some(solution.year) || year.is_none())
2228
.filter(|solution| day == Some(solution.day) || day.is_none())
2329
.collect();
@@ -73,9 +79,8 @@ macro_rules! solution {
7379
};
7480
}
7581

76-
fn all_solutions() -> Vec<Solution> {
82+
fn year2015() -> Vec<Solution> {
7783
vec![
78-
// 2015
7984
solution!(year2015, day01),
8085
solution!(year2015, day02),
8186
solution!(year2015, day03),
@@ -101,7 +106,11 @@ fn all_solutions() -> Vec<Solution> {
101106
solution!(year2015, day23),
102107
solution!(year2015, day24),
103108
solution!(year2015, day25),
104-
// 2016
109+
]
110+
}
111+
112+
fn year2016() -> Vec<Solution> {
113+
vec![
105114
solution!(year2016, day01),
106115
solution!(year2016, day02),
107116
solution!(year2016, day03),
@@ -127,7 +136,11 @@ fn all_solutions() -> Vec<Solution> {
127136
solution!(year2016, day23),
128137
solution!(year2016, day24),
129138
solution!(year2016, day25),
130-
// 2019
139+
]
140+
}
141+
142+
fn year2019() -> Vec<Solution> {
143+
vec![
131144
solution!(year2019, day01),
132145
solution!(year2019, day02),
133146
solution!(year2019, day03),
@@ -153,7 +166,11 @@ fn all_solutions() -> Vec<Solution> {
153166
solution!(year2019, day23),
154167
solution!(year2019, day24),
155168
solution!(year2019, day25),
156-
// 2020
169+
]
170+
}
171+
172+
fn year2020() -> Vec<Solution> {
173+
vec![
157174
solution!(year2020, day01),
158175
solution!(year2020, day02),
159176
solution!(year2020, day03),
@@ -179,7 +196,11 @@ fn all_solutions() -> Vec<Solution> {
179196
solution!(year2020, day23),
180197
solution!(year2020, day24),
181198
solution!(year2020, day25),
182-
// 2021
199+
]
200+
}
201+
202+
fn year2021() -> Vec<Solution> {
203+
vec![
183204
solution!(year2021, day01),
184205
solution!(year2021, day02),
185206
solution!(year2021, day03),
@@ -205,7 +226,11 @@ fn all_solutions() -> Vec<Solution> {
205226
solution!(year2021, day23),
206227
solution!(year2021, day24),
207228
solution!(year2021, day25),
208-
// 2022
229+
]
230+
}
231+
232+
fn year2022() -> Vec<Solution> {
233+
vec![
209234
solution!(year2022, day01),
210235
solution!(year2022, day02),
211236
solution!(year2022, day03),

0 commit comments

Comments
 (0)