소스 검색

fix day14 missing clone and clean up day15

niels 2 년 전
부모
커밋
b5be98ba3f
2개의 변경된 파일3개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 0
      src/bin/day14.rs
  2. 1 5
      src/bin/day15.rs

+ 2 - 0
src/bin/day14.rs

@@ -50,6 +50,8 @@ pub fn run(input: &Vec<String>) -> AOCResult {
         }
     }
 
+    let wall_map = map.clone();
+
     let death_plane = *map.iter().map(|(_, y)| y).max().unwrap();
 
     let floor = death_plane + 2;

+ 1 - 5
src/bin/day15.rs

@@ -9,7 +9,6 @@ use nom::{
 };
 use std::{
     collections::{HashMap, HashSet},
-    mem,
     ops::Range,
 };
 
@@ -126,13 +125,10 @@ pub fn run(input: &Vec<String>) -> AOCResult {
         }
     }
 
-    let (s, r): (Vec<_>, Vec<_>) = sensors.clone().into_iter().unzip();
-    let (sx, sy): (Vec<_>, Vec<_>) = s.into_iter().unzip();
-
     let possible_locations = oor_intersections.iter().filter(|(_, n)| **n >= 4);
     println!("l={:?}", possible_locations.clone().map(|(i, _)| i).collect::<Vec<_>>().as_slice());
     let mut location = None;
-    for (pos, n) in possible_locations {
+    for (pos, _) in possible_locations {
         let mut in_range = false;
         for (sensor, range) in sensors.iter() {
             if (sensor.0.abs_diff(pos.0) + sensor.1.abs_diff(pos.1)) as Num <= *range {