Add belt finding to layouting
This commit is contained in:
parent
c572fcb0e2
commit
5a6be3194e
4 changed files with 114 additions and 31 deletions
|
|
@ -1,4 +1,8 @@
|
|||
use factorio_blueprint::{common::visualize::Visualize, layout::Layout};
|
||||
use factorio_blueprint::{
|
||||
belt_finding::{conflict_avoidance::ConflictAvoidance, Problem},
|
||||
common::visualize::Visualize,
|
||||
layout::Layout,
|
||||
};
|
||||
use rand::SeedableRng;
|
||||
|
||||
fn main() {
|
||||
|
|
@ -15,13 +19,29 @@ fn main() {
|
|||
|
||||
let p = serde_yaml::from_reader(file).unwrap();
|
||||
|
||||
for i in 0..100 {
|
||||
let mut rng = rand::rngs::SmallRng::seed_from_u64(i);
|
||||
for i in 0..1 {
|
||||
let mut rng = rand::rngs::SmallRng::seed_from_u64(5);
|
||||
|
||||
let l = Layout::new(&p, &mut rng);
|
||||
|
||||
println!("Seed: {i}, Score {}", l.score());
|
||||
|
||||
// let s = l.score();
|
||||
l.print_visualization();
|
||||
|
||||
let mut p = Problem::from_layout(&l);
|
||||
p.print();
|
||||
p.find_path();
|
||||
p.print();
|
||||
let mut c = ConflictAvoidance::new(p);
|
||||
|
||||
c.remove_all_conflicts();
|
||||
|
||||
c.print();
|
||||
// println!("Seed: {i}, Score {}", s);
|
||||
|
||||
// l.print_visualization();
|
||||
// if s < min {
|
||||
// min = s;
|
||||
// min_l = Some(l);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue