diff options
| author | omagdy <omar.professional8777@gmail.com> | 2024-12-08 15:27:42 +0200 |
|---|---|---|
| committer | omagdy <omar.professional8777@gmail.com> | 2024-12-08 15:27:42 +0200 |
| commit | 57fc57ecc40f879a3ccb637a5f420a1e0a655eab (patch) | |
| tree | d21b8ee3a528f1e4bb8f856c0fedce235d4938c4 /2023/Rust/src | |
| parent | fc6ef54eb1b7e91fbcc263ebcc5151e9ec055130 (diff) | |
| download | aoc-57fc57ecc40f879a3ccb637a5f420a1e0a655eab.tar.xz aoc-57fc57ecc40f879a3ccb637a5f420a1e0a655eab.zip | |
commiting to fix git shennanings probably because persmssions changed
Diffstat (limited to '2023/Rust/src')
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day1.rs | 0 | ||||
| -rwxr-xr-x | 2023/Rust/src/day10.rs | 62 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day2.rs | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day3.rs | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day4.rs | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day5.rs | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day6.rs | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day7.rs | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day8.rs | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | 2023/Rust/src/day9.rs | 0 |
10 files changed, 62 insertions, 0 deletions
diff --git a/2023/Rust/src/day1.rs b/2023/Rust/src/day1.rs index c8fae40..c8fae40 100644..100755 --- a/2023/Rust/src/day1.rs +++ b/2023/Rust/src/day1.rs diff --git a/2023/Rust/src/day10.rs b/2023/Rust/src/day10.rs new file mode 100755 index 0000000..15eade1 --- /dev/null +++ b/2023/Rust/src/day10.rs @@ -0,0 +1,62 @@ +#[derive(Debug)] +enum Pipe { + Vertical, // | + Horizontal, // - + NorthEast, // L + NorthWest, // J + SouthWest, // 7 + SouthEast, // F + Ground, // . + Start, // S +} + +#[derive(Debug)] +struct Maze { + data: Vec<Vec<Pipe>>, +} + +impl From<&str> for Maze { + fn from(maze: &str) -> Self { + use Pipe::*; + let mut data: Vec<Vec<Pipe>> = vec![]; + for line in maze.lines() { + let line = line.as_bytes(); + let mut pipe_line: Vec<Pipe> = vec![]; + for ch in line { + match ch { + b'|' => pipe_line.push(Vertical), + b'-' => pipe_line.push(Horizontal), + b'L' => pipe_line.push(NorthEast), + b'J' => pipe_line.push(NorthWest), + b'7' => pipe_line.push(SouthWest), + b'F' => pipe_line.push(SouthEast), + b'.' => pipe_line.push(Ground), + b'S' => pipe_line.push(Start), + _ => {} + } + } + data.push(pipe_line); + } + Maze { data } + } +} + +fn solve_part_one(data: &str) -> u64 { + let maze = Maze::from(data); + dbg!(maze); + todo!() +} + +fn solve_part_two(data: &str) -> u64 { + todo!() +} + +fn main() { + let test_1 = include_str!("../input/day10_1.test"); + let test_2 = include_str!("../input/day10_2.test"); + let prod = include_str!("../input/day10.prod"); + println!("part_1 test: {:?}", solve_part_one(test_1)); + // println!("part_1 prod {:?}", solve_part_one(prod)); + // println!("part_2 test: {:?}", solve_part_two(test_2)); + // println!("part_2 prod {:?}", solve_part_two(prod)); +} diff --git a/2023/Rust/src/day2.rs b/2023/Rust/src/day2.rs index c93d6dd..c93d6dd 100644..100755 --- a/2023/Rust/src/day2.rs +++ b/2023/Rust/src/day2.rs diff --git a/2023/Rust/src/day3.rs b/2023/Rust/src/day3.rs index acd7d7d..acd7d7d 100644..100755 --- a/2023/Rust/src/day3.rs +++ b/2023/Rust/src/day3.rs diff --git a/2023/Rust/src/day4.rs b/2023/Rust/src/day4.rs index 59c8cfc..59c8cfc 100644..100755 --- a/2023/Rust/src/day4.rs +++ b/2023/Rust/src/day4.rs diff --git a/2023/Rust/src/day5.rs b/2023/Rust/src/day5.rs index 16fc8e1..16fc8e1 100644..100755 --- a/2023/Rust/src/day5.rs +++ b/2023/Rust/src/day5.rs diff --git a/2023/Rust/src/day6.rs b/2023/Rust/src/day6.rs index 22f98ff..22f98ff 100644..100755 --- a/2023/Rust/src/day6.rs +++ b/2023/Rust/src/day6.rs diff --git a/2023/Rust/src/day7.rs b/2023/Rust/src/day7.rs index 5429b92..5429b92 100644..100755 --- a/2023/Rust/src/day7.rs +++ b/2023/Rust/src/day7.rs diff --git a/2023/Rust/src/day8.rs b/2023/Rust/src/day8.rs index 859b434..859b434 100644..100755 --- a/2023/Rust/src/day8.rs +++ b/2023/Rust/src/day8.rs diff --git a/2023/Rust/src/day9.rs b/2023/Rust/src/day9.rs index ed8d63e..ed8d63e 100644..100755 --- a/2023/Rust/src/day9.rs +++ b/2023/Rust/src/day9.rs |
