diff --git a/days/2024/16.rs b/days/2024/16.rs index 9cfdf0a..3d6f06e 100644 --- a/days/2024/16.rs +++ b/days/2024/16.rs @@ -26,18 +26,18 @@ fn new_score(old_score: u32, old: KD, new: KD) -> u32 { } } -fn sorter(a: &(Kartesian, KartesianDirection, u32, Kartesian), b: &(Kartesian, KartesianDirection, u32, Kartesian)) -> Ordering { +fn sorter(a: &(Kartesian, KartesianDirection, u32), b: &(Kartesian, KartesianDirection, u32)) -> Ordering { a.2.cmp(&b.2).reverse() } fn search_end(map: &Map, startpos: Kartesian, last_dir: KartesianDirection) -> u32 { let mut posmap: HashMap, u32> = HashMap::new(); let mut branches = Vec::with_capacity(200); - branches.push((startpos, last_dir, 0, startpos)); + branches.push((startpos, last_dir, 0)); let mut vmap = map.clone(); let mut best = u32::MAX; loop { - let (newpos, old_dir, score, oldpos) = match branches.pop() { + let (newpos, old_dir, score) = match branches.pop() { Some(b) => b, None => break, }; @@ -72,7 +72,7 @@ fn search_end(map: &Map, startpos: Kartesian, last_dir: KartesianDi }, SPACE | START => { let added = new_score(score, old_dir, dir); - branches.push((after_move, dir, added, newpos)); + branches.push((after_move, dir, added)); }, _ => unreachable!(), }