Remove debugging

This commit is contained in:
Malte Tammena 2022-12-12 21:04:57 +01:00
parent 59949a63ec
commit 105989cdb7
2 changed files with 3 additions and 9 deletions

View file

@ -3,6 +3,8 @@ name = "day12-tim"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [package.metadata.nix]
build = true
app = true
[dependencies] [dependencies]

View file

@ -12,7 +12,6 @@ pub struct HeightMap {
impl HeightMap { impl HeightMap {
pub fn find_shortest_path_len_to_end<const TARGET: u8>(&self) -> usize { pub fn find_shortest_path_len_to_end<const TARGET: u8>(&self) -> usize {
let mut iterations = 0;
let mut visited: Vec<bool> = self.heights.iter().map(|_| false).collect(); let mut visited: Vec<bool> = self.heights.iter().map(|_| false).collect();
let mut open: PriorityQueue<usize, Reverse<u32>, DefaultHashBuilder> = let mut open: PriorityQueue<usize, Reverse<u32>, DefaultHashBuilder> =
PriorityQueue::with_hasher(DefaultHashBuilder::default()); PriorityQueue::with_hasher(DefaultHashBuilder::default());
@ -25,14 +24,7 @@ impl HeightMap {
.0; .0;
open.push(end_idx, Reverse(0)); open.push(end_idx, Reverse(0));
while let Some((current_idx, Reverse(current_score))) = open.pop() { while let Some((current_idx, Reverse(current_score))) = open.pop() {
iterations += 1;
if self.heights[current_idx] == TARGET { if self.heights[current_idx] == TARGET {
eprintln!(
"Iter: {iterations} | {}x{} = {}",
self.width,
self.height,
self.height * self.width
);
return current_score as usize; return current_score as usize;
} }
visited[current_idx] = true; visited[current_idx] = true;