diff --git a/advent_of_code/2024/9/src/main.rs b/advent_of_code/2024/9/src/main.rs index 1023f6f..e2a36a5 100644 --- a/advent_of_code/2024/9/src/main.rs +++ b/advent_of_code/2024/9/src/main.rs @@ -1,8 +1,42 @@ -struct Tree { +use std::{cell::RefCell, rc::Rc}; +#[derive(Debug, Clone)] +struct FileTree { + val: u32, + left: Option, + right: Option, } -fn solve_1(input: &str) -> u32 {} +type TreeNodeRef = Rc>; + +impl FileTree { + fn new() -> Self { + FileTree { + val: 0, + left: None, + right: None, + } + } + + fn fill(&mut self, filesystem: &[u32]) { + for (i, file) in filesystem.iter().enumerate() { + } + } + + fn add_file(&mut self, length: u32) {} + fn add_empty(&mut self, length: u32) {} +} + +fn parse(input: &str) -> Vec { + input.chars().map(|c| c.to_digit(10).unwrap()).collect() +} + +fn solve_1(input: &str) -> u32 { + let filesystem = parse(input); + let mut filetree = FileTree::new(); + + filetree.fill(&filesystem[..]); +} fn solve_2(input: &str) {}