Simple Path
This commit is contained in:
parent
7d47a10acf
commit
6f6a7f978b
6 changed files with 333 additions and 161 deletions
|
|
@ -1,14 +0,0 @@
|
|||
use factorio_blueprint::{
|
||||
belt_finding::{find_path, Field, Position, QueueObject},
|
||||
misc::Map,
|
||||
priority_queue::BinaryHeap,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let mut map: Map<Field> = Map::new(5, 5);
|
||||
map.get_mut(2, 0).blocked = true;
|
||||
map.get_mut(2, 1).blocked = true;
|
||||
map.get_mut(2, 2).blocked = true;
|
||||
|
||||
find_path::<BinaryHeap<QueueObject>>(map, Position { x: 0, y: 0 }, Position { x: 4, y: 0 });
|
||||
}
|
||||
39
examples/solve_belt.rs
Normal file
39
examples/solve_belt.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
use factorio_blueprint::belt_finding::{Position, Problem};
|
||||
|
||||
fn main() {
|
||||
let mut p = Problem::new(17, 13, Position::new(3, 8), Position::new(13, 5));
|
||||
|
||||
p.set_blocked(0, 3, true);
|
||||
|
||||
p.set_blocked(1, 4, true);
|
||||
p.set_blocked(2, 4, true);
|
||||
p.set_blocked(1, 5, true);
|
||||
p.set_blocked(2, 5, true);
|
||||
|
||||
p.set_blocked(1, 7, true);
|
||||
p.set_blocked(2, 7, true);
|
||||
p.set_blocked(1, 8, true);
|
||||
p.set_blocked(2, 8, true);
|
||||
|
||||
p.set_blocked(0, 9, true);
|
||||
|
||||
p.set_blocked(16, 3, true);
|
||||
|
||||
p.set_blocked(14, 4, true);
|
||||
p.set_blocked(15, 4, true);
|
||||
p.set_blocked(14, 5, true);
|
||||
p.set_blocked(15, 5, true);
|
||||
|
||||
p.set_blocked(14, 7, true);
|
||||
p.set_blocked(15, 7, true);
|
||||
p.set_blocked(14, 8, true);
|
||||
p.set_blocked(15, 8, true);
|
||||
|
||||
p.set_blocked(16, 9, true);
|
||||
|
||||
println!("{}", p);
|
||||
|
||||
p.find_path();
|
||||
|
||||
println!("{}", p);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue