Skip to content

Commit 9e9e8c2

Browse files
committed
feat: create boilerplate for day 1/2024
1 parent 612d5f9 commit 9e9e8c2

File tree

6 files changed

+59
-33
lines changed

6 files changed

+59
-33
lines changed

resources/2024/inputs/.gitkeep

Whitespace-only changes.

resources/2024/outputs/.gitkeep

Whitespace-only changes.

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
use crate::aoc::year::Year::Year2024;
12
use crate::commands::input::download_input;
23
use crate::commands::output::download_output;
34
use crate::commands::solve::solve;
45
use aoc::day_number::DayNumber;
56
use aoc::puzzle_part::PuzzlePart;
67
use aoc::year::Year;
7-
use aoc::year::Year::Year2023;
88
use clap::{Parser, Subcommand};
99
use dotenv::dotenv;
1010

@@ -66,7 +66,7 @@ fn main() {
6666
let day_number_option = day_option.map(|d| DayNumber::try_from(d).unwrap());
6767
let day_number: DayNumber = DayNumber::try_from(day_option.unwrap_or(1).to_string()).unwrap();
6868

69-
let year = cli.year.unwrap_or(Year2023);
69+
let year = cli.year.unwrap_or(Year2024);
7070

7171
match command {
7272
Command::Solve { submit_answer } => {

src/solutions/mod.rs

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
use crate::aoc::day_number::DayNumber;
22
use crate::aoc::year::Year;
3-
use crate::solutions::year2023::day19;
4-
use year2023::{
5-
day01, day02, day03, day04, day05, day06, day07, day08, day09, day10, day11, day12, day13,
6-
day14, day15, day16, day17, day18, day20, day21, day22, day23, day24, day25,
7-
};
83

94
mod year2023;
5+
mod year2024;
106

117
pub trait Solution {
128
fn part_one(&self, input: &str) -> String;
@@ -18,33 +14,36 @@ pub fn solution(day: DayNumber, year: Year) -> Box<dyn Solution> {
1814

1915
match year {
2016
Year::Year2023 => match i {
21-
1 => Box::new(day01::Day01),
22-
2 => Box::new(day02::Day02),
23-
3 => Box::new(day03::Day03),
24-
4 => Box::new(day04::Day04),
25-
5 => Box::new(day05::Day05),
26-
6 => Box::new(day06::Day06),
27-
7 => Box::new(day07::Day07),
28-
8 => Box::new(day08::Day08),
29-
9 => Box::new(day09::Day09),
30-
10 => Box::new(day10::Day10),
31-
11 => Box::new(day11::Day11),
32-
12 => Box::new(day12::Day12),
33-
13 => Box::new(day13::Day13),
34-
14 => Box::new(day14::Day14),
35-
15 => Box::new(day15::Day15),
36-
16 => Box::new(day16::Day16),
37-
17 => Box::new(day17::Day17),
38-
18 => Box::new(day18::Day18),
39-
19 => Box::new(day19::Day19),
40-
20 => Box::new(day20::Day20),
41-
21 => Box::new(day21::Day21),
42-
22 => Box::new(day22::Day22),
43-
23 => Box::new(day23::Day23),
44-
24 => Box::new(day24::Day24),
45-
25 => Box::new(day25::Day25),
17+
1 => Box::new(year2023::day01::Day01),
18+
2 => Box::new(year2023::day02::Day02),
19+
3 => Box::new(year2023::day03::Day03),
20+
4 => Box::new(year2023::day04::Day04),
21+
5 => Box::new(year2023::day05::Day05),
22+
6 => Box::new(year2023::day06::Day06),
23+
7 => Box::new(year2023::day07::Day07),
24+
8 => Box::new(year2023::day08::Day08),
25+
9 => Box::new(year2023::day09::Day09),
26+
10 => Box::new(year2023::day10::Day10),
27+
11 => Box::new(year2023::day11::Day11),
28+
12 => Box::new(year2023::day12::Day12),
29+
13 => Box::new(year2023::day13::Day13),
30+
14 => Box::new(year2023::day14::Day14),
31+
15 => Box::new(year2023::day15::Day15),
32+
16 => Box::new(year2023::day16::Day16),
33+
17 => Box::new(year2023::day17::Day17),
34+
18 => Box::new(year2023::day18::Day18),
35+
19 => Box::new(year2023::day19::Day19),
36+
20 => Box::new(year2023::day20::Day20),
37+
21 => Box::new(year2023::day21::Day21),
38+
22 => Box::new(year2023::day22::Day22),
39+
23 => Box::new(year2023::day23::Day23),
40+
24 => Box::new(year2023::day24::Day24),
41+
25 => Box::new(year2023::day25::Day25),
42+
_ => panic!("Day not exist"),
43+
},
44+
Year::Year2024 => match i {
45+
1 => Box::new(year2024::day01::Day01),
4646
_ => panic!("Day not exist"),
4747
},
48-
Year::Year2024 => todo!("2024 is not implemented yet"),
4948
}
5049
}

src/solutions/year2024/day01.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use crate::solutions::Solution;
2+
3+
pub struct Day01;
4+
5+
impl Solution for Day01 {
6+
fn part_one(&self, _input: &str) -> String {
7+
String::new()
8+
}
9+
10+
fn part_two(&self, _input: &str) -> String {
11+
String::new()
12+
}
13+
}
14+
15+
#[cfg(test)]
16+
mod tests {
17+
use crate::solutions::year2024::day01::Day01;
18+
use crate::solutions::Solution;
19+
20+
const EXAMPLE: &str = "";
21+
22+
#[test]
23+
fn part_one_example_test() {
24+
assert_eq!("", Day01.part_one(EXAMPLE));
25+
}
26+
}

src/solutions/year2024/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod day01;

0 commit comments

Comments
 (0)