Initial layout implementation.
This commit is contained in:
parent
1596bf180d
commit
f284b692cc
7 changed files with 374 additions and 6 deletions
25
examples/layout.rs
Normal file
25
examples/layout.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use factorio_blueprint::{
|
||||
belt_finding::common::Position,
|
||||
layout::{Layout, Problem},
|
||||
};
|
||||
use rand::SeedableRng;
|
||||
|
||||
fn main() {
|
||||
let mut p = Problem::new(Position::new(10, 10));
|
||||
|
||||
let b1 = p.add_block(Position::new(3, 2));
|
||||
let b2 = p.add_block(Position::new(5, 2));
|
||||
let b3 = p.add_block(Position::new(5, 7));
|
||||
|
||||
p.add_connection(b1, Position::new(0, 0), b2, Position::new(0, 0));
|
||||
p.add_connection(b2, Position::new(3, 1), b3, Position::new(4, 6));
|
||||
|
||||
for i in 0..10 {
|
||||
let mut rng = rand::rngs::SmallRng::seed_from_u64(i);
|
||||
|
||||
let l = Layout::new(&p, &mut rng);
|
||||
|
||||
println!("Seed: {i}, Score {}", l.score());
|
||||
l.print();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue