Multi Path
This commit is contained in:
parent
6f6a7f978b
commit
c10843ad2f
3 changed files with 142 additions and 34 deletions
32
examples/solve_belt2.rs
Normal file
32
examples/solve_belt2.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
use factorio_blueprint::belt_finding::{Position, Problem};
|
||||
|
||||
fn main() {
|
||||
let mut p = Problem::new(33, 13);
|
||||
|
||||
p.set_blocked_range(1, 3, 2, 5, true);
|
||||
p.set_blocked_range(1, 7, 2, 9, true);
|
||||
|
||||
p.set_blocked(0, 3, true);
|
||||
p.set_blocked(0, 8, true);
|
||||
|
||||
p.set_blocked_range(10, 0, 21, 2, true);
|
||||
p.set_blocked_range(10, 5, 21, 7, true);
|
||||
p.set_blocked_range(10, 10, 21, 12, true);
|
||||
|
||||
p.set_blocked_range(30, 3, 31, 5, true);
|
||||
p.set_blocked_range(30, 7, 31, 9, true);
|
||||
p.set_blocked(32, 3, true);
|
||||
p.set_blocked(32, 9, true);
|
||||
|
||||
p.add_connection(Position::new(3, 3), Position::new(29, 7));
|
||||
p.add_connection(Position::new(3, 4), Position::new(29, 9));
|
||||
p.add_connection(Position::new(3, 5), Position::new(29, 8));
|
||||
|
||||
p.add_connection(Position::new(3, 7), Position::new(29, 3));
|
||||
p.add_connection(Position::new(3, 8), Position::new(29, 5));
|
||||
p.add_connection(Position::new(3, 9), Position::new(29, 4));
|
||||
|
||||
println!("{p}");
|
||||
p.find_path();
|
||||
println!("{p}");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue