day17: don't revisit the start position

This commit is contained in:
Keenan Tims 2023-12-17 20:55:42 -08:00
parent 3ee26cefe5
commit e65c17c8e6
Signed by: ktims
GPG Key ID: 11230674D69038D4

View File

@ -311,6 +311,7 @@ impl<'a> WalkCost2<'a> {
weight: cur_move.weight + self.map.map[new_pos.1][new_pos.0], weight: cur_move.weight + self.map.map[new_pos.1][new_pos.0],
}) })
}) })
.filter(|m| m.new_pos != self.start)
.filter(|m| *m.dir != cur_move.dir.opposite()) .filter(|m| *m.dir != cur_move.dir.opposite())
.filter(|m| { .filter(|m| {
if m.dir == cur_move.dir { if m.dir == cur_move.dir {