2023-12-02 12:01:30 -07:00
|
|
|
pub trait Day: std::fmt::Debug {
|
|
|
|
fn part1(&mut self) -> String;
|
|
|
|
fn part2(&mut self) -> String;
|
2023-12-06 21:55:04 -07:00
|
|
|
fn part1_large(&mut self) -> String {
|
|
|
|
self.part1()
|
|
|
|
}
|
|
|
|
fn part2_large(&mut self) -> String {
|
|
|
|
self.part2()
|
|
|
|
}
|
2023-12-03 00:27:13 -07:00
|
|
|
fn parse(&mut self) {}
|
2023-12-06 21:55:04 -07:00
|
|
|
fn solve(&mut self, part: u8, large: bool) -> String {
|
2023-12-02 12:01:30 -07:00
|
|
|
self.parse();
|
|
|
|
match part {
|
2023-12-06 21:55:04 -07:00
|
|
|
1 => match large {
|
|
|
|
false => self.part1(),
|
|
|
|
true => self.part1_large(),
|
|
|
|
},
|
|
|
|
2 => match large {
|
|
|
|
false => self.part2(),
|
|
|
|
true => self.part2_large(),
|
|
|
|
},
|
2023-12-03 00:27:13 -07:00
|
|
|
_ => panic!("Invalid part #"),
|
2023-12-02 12:01:30 -07:00
|
|
|
}
|
|
|
|
}
|
2023-12-03 00:27:13 -07:00
|
|
|
}
|