summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2021-12-23 10:25:06 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2021-12-23 10:25:06 +0000
commit0ec2e7e06ab99366f92bea5c20805ba2dd521834 (patch)
tree8aea6e6496eb31c9c7493b116117a5bd6fd87637
parented13e0ec6fd43828a48e7d9fe6ef4479fcb5c2ff (diff)
downloadaoc-0ec2e7e06ab99366f92bea5c20805ba2dd521834.tar.bz2
2021: Clean up commented out debugging in day 23
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--2021/src/bin/2021day23.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/2021/src/bin/2021day23.rs b/2021/src/bin/2021day23.rs
index 22e740c..f34b540 100644
--- a/2021/src/bin/2021day23.rs
+++ b/2021/src/bin/2021day23.rs
@@ -96,7 +96,6 @@ impl AmbiCave {
fn neighbours(&self) -> Vec<(Self, usize)> {
let mut ret = Vec::new();
- //println!("Starting at {:?}", self);
// All possible neighbours of this node in the search graph
// will either move an ambipod out of a cave, or into its target cave
@@ -110,17 +109,8 @@ impl AmbiCave {
if ambipod == 0 {
continue;
}
- //println!(
- // "Want to try and move ambipod {} from cave {} pos {}",
- // ambipod, cave, pos
- //);
// is our path out of the cave clear?
if pos < 3 && self.caves[cave].iter().skip(pos + 1).any(|v| *v != 0) {
- //println!("Can't! our path out isn't clear");
- //self.caves[cave]
- // .iter()
- // .skip(pos + 1)
- // .for_each(|v| println!("pod {} in the way", v));
continue;
}
// Our path is clear out of the cave, but do we want to move?
@@ -130,10 +120,8 @@ impl AmbiCave {
.take(pos + 1)
.all(|v| *v == (cave + 1) as u8)
{
- //println!("No point, everyone in the cave is us");
continue;
}
- //println!("Let's give it a go");
// Otherwise try and fit it into each hallway slot
for hidx in 0..7 {
if self.cave_to_hallway_clear(cave, hidx) {
@@ -159,12 +147,7 @@ impl AmbiCave {
}
// is the target cave "available"? first is the path clear
let cave = (ambipod as usize) - 1;
- //println!(
- // "Could we move pod {} from hidx {} to cave {}?",
- // ambipod, hidx, cave
- //);
if !self.hallway_to_cave_clear(cave, hidx) {
- //println!("No, hallway isn't clear");
continue;
}
let base_cost = Self::hallway_cave_dist(cave, hidx);
@@ -172,7 +155,6 @@ impl AmbiCave {
// we can only move into the cave if the cave contains nothing
// which isn't us.
if self.caves[cave].iter().any(|v| *v != 0 && *v != ambipod) {
- //println!("No, the cave has something not us in it");
continue;
}
// OK, the cave has *only* us in it, so let's try and move in
@@ -183,10 +165,6 @@ impl AmbiCave {
.find(|v| v.1 == 0)
.expect("What?")
.0;
- //println!(
- // "Yes, moving pod {} from hidx {} to cave {} pos {}",
- // ambipod, hidx, cave, pos
- //);
let mut newstate = *self;
newstate.hallway[hidx] = 0;
newstate.caves[cave][pos] = ambipod;
@@ -195,14 +173,6 @@ impl AmbiCave {
ret.push((newstate, cost));
}
- //if ret.is_empty() {
- // println!("No moves given {:?}", self);
- //} else {
- // for c in &ret {
- // println!("{:?} for {}", c.0, c.1);
- // }
- //}
-
ret
}