Multipath brute force
This commit is contained in:
parent
20073b88ce
commit
5d9926fba7
4 changed files with 165 additions and 52 deletions
|
|
@ -11,14 +11,40 @@ fn main() {
|
|||
|
||||
b.add_path(
|
||||
(Position::new(1, 0), Direction::Down),
|
||||
(Position::new(4, 6), Direction::Up),
|
||||
(Position::new(0, 0), Direction::Up),
|
||||
);
|
||||
|
||||
b.set_blocked_range(0, 2, 5, 5, true);
|
||||
b.add_path(
|
||||
(Position::new(4, 0), Direction::Down),
|
||||
(Position::new(1, 7), Direction::Up),
|
||||
);
|
||||
|
||||
b.set_blocked_range(0, 2, 5, 4, true);
|
||||
// b.set_blocked_range(2, 0, 2, 2, true);
|
||||
|
||||
let mut b = b.build();
|
||||
|
||||
while b.next_finish_state() {
|
||||
println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
}
|
||||
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
// b.next_state();
|
||||
// println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
}
|
||||
|
|
|
|||
48
examples/brute_force2.rs
Normal file
48
examples/brute_force2.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
use factorio_blueprint::belt_finding::{brute_force::BruteforceBuilder, Direction, Position};
|
||||
|
||||
fn main() {
|
||||
let mut b = BruteforceBuilder::new(20, 5);
|
||||
|
||||
b.add_path(
|
||||
(Position::new(0, 0), Direction::Right),
|
||||
(Position::new(19, 0), Direction::Right),
|
||||
);
|
||||
|
||||
b.add_path(
|
||||
(Position::new(0, 1), Direction::Right),
|
||||
(Position::new(19, 1), Direction::Right),
|
||||
);
|
||||
|
||||
b.add_path(
|
||||
(Position::new(0, 2), Direction::Right),
|
||||
(Position::new(19, 2), Direction::Right),
|
||||
);
|
||||
|
||||
b.add_path(
|
||||
(Position::new(0, 3), Direction::Right),
|
||||
(Position::new(19, 3), Direction::Right),
|
||||
);
|
||||
|
||||
b.add_path(
|
||||
(Position::new(0, 4), Direction::Right),
|
||||
(Position::new(19, 4), Direction::Right),
|
||||
);
|
||||
|
||||
// b.add_path(
|
||||
// (Position::new(0, 5), Direction::Right),
|
||||
// (Position::new(19, 5), Direction::Right),
|
||||
// );
|
||||
|
||||
b.set_blocked_range(4, 2, 16, 2, true);
|
||||
b.set_blocked_range(7, 3, 10, 4, true);
|
||||
|
||||
// b.set_blocked_range(4, 0, 7, 2, true);
|
||||
|
||||
let mut b = b.build();
|
||||
|
||||
println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
while b.next_finish_state() {
|
||||
println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
|
||||
}
|
||||
println!("{}\n{}", b.count(), b.solution_count());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue