Fix bugs.
This commit is contained in:
parent
0b84841768
commit
55ef06f868
3 changed files with 41 additions and 4 deletions
|
|
@ -16,6 +16,7 @@ enum Problem {
|
|||
Mid,
|
||||
Snake,
|
||||
Weaving,
|
||||
Debug,
|
||||
}
|
||||
|
||||
impl Problem {
|
||||
|
|
@ -25,6 +26,7 @@ impl Problem {
|
|||
Problem::Mid => problems::mid(),
|
||||
Problem::Snake => problems::snake(),
|
||||
Problem::Weaving => problems::weaving(),
|
||||
Problem::Debug => problems::debug(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -802,4 +802,35 @@ pub mod problems {
|
|||
|
||||
b.build()
|
||||
}
|
||||
|
||||
pub fn debug() -> Bruteforce {
|
||||
let mut b = BruteforceBuilder::new(5, 10);
|
||||
|
||||
b.set_blocked_range(0, 0, 4, 0, true);
|
||||
b.set_blocked_range(0, 9, 4, 9, true);
|
||||
b.set_blocked_range(0, 0, 0, 9, true);
|
||||
b.set_blocked_range(4, 0, 4, 9, true);
|
||||
|
||||
// b.set_blocked_range(3, 2, 3, 3, true);
|
||||
// b.set_blocked_range(3, 5, 3, 6, true);
|
||||
|
||||
b.add_path(
|
||||
(Position::new(0, 2), Direction::Right),
|
||||
(Position::new(3, 2), Direction::Right),
|
||||
);
|
||||
b.add_path(
|
||||
(Position::new(0, 3), Direction::Right),
|
||||
(Position::new(3, 5), Direction::Right),
|
||||
);
|
||||
b.add_path(
|
||||
(Position::new(0, 6), Direction::Right),
|
||||
(Position::new(3, 6), Direction::Right),
|
||||
);
|
||||
b.add_path(
|
||||
(Position::new(0, 7), Direction::Right),
|
||||
(Position::new(3, 3), Direction::Right),
|
||||
);
|
||||
|
||||
b.build()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ impl ConflictAvoidance {
|
|||
dir: problem.end[i].1,
|
||||
});
|
||||
|
||||
p.push(PathField::Belt {
|
||||
pos: problem.end[i].0,
|
||||
dir: problem.end[i].1,
|
||||
});
|
||||
// p.push(PathField::Belt {
|
||||
// pos: problem.end[i].0,
|
||||
// dir: problem.end[i].1,
|
||||
// });
|
||||
|
||||
belts.push(p);
|
||||
}
|
||||
|
|
@ -370,6 +370,10 @@ impl ConflictAvoidance {
|
|||
),
|
||||
);
|
||||
candidate.extend_range(&conflicts);
|
||||
if candidate != c && !candidates.iter().any(|c| c == &candidate) {
|
||||
candidates.push(candidate);
|
||||
}
|
||||
// dbg!(&candidates);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue