Add factory generator
This commit is contained in:
parent
295490858b
commit
6fbff67e61
14 changed files with 308 additions and 15 deletions
|
|
@ -31,12 +31,12 @@ fn main() {
|
|||
};
|
||||
|
||||
let p = ConflictAvoidance {
|
||||
timeout: Some(std::time::Duration::from_millis(100)),
|
||||
timeout: Some(std::time::Duration::from_millis(5)),
|
||||
};
|
||||
|
||||
let mut rng = SmallRng::seed_from_u64(args.seed);
|
||||
|
||||
let r = l.layout(&problem, &p, &mut rng);
|
||||
|
||||
dbg!(r);
|
||||
// dbg!(r);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,20 +152,20 @@ pub fn valid_path_layout<'a, R: Rng + ?Sized>(
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub(crate) struct MacroBlock {
|
||||
pub(crate) size: Position,
|
||||
pub(crate) input: Vec<Interface>,
|
||||
pub(crate) output: Vec<Interface>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
||||
pub(crate) struct Interface {
|
||||
pub(crate) offset: Position,
|
||||
pub(crate) dir: Direction,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
||||
pub(crate) struct Connection {
|
||||
pub(crate) startblock: usize,
|
||||
pub(crate) startpoint: usize,
|
||||
|
|
@ -173,7 +173,7 @@ pub(crate) struct Connection {
|
|||
pub(crate) endpoint: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Problem {
|
||||
pub(crate) size: Position,
|
||||
pub(crate) blocks: Vec<MacroBlock>,
|
||||
|
|
|
|||
|
|
@ -3,21 +3,20 @@ use factorio_pathfinding::Pathfinder;
|
|||
use rand::Rng;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod block;
|
||||
pub mod genetic_algorithm_v1;
|
||||
pub mod genetic_algorithm_v2;
|
||||
pub mod layout;
|
||||
pub mod misc;
|
||||
pub mod valid_layout;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct MacroBlock {
|
||||
pub size: Position,
|
||||
pub input: Vec<Interface>,
|
||||
pub output: Vec<Interface>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
||||
pub struct Interface {
|
||||
pub offset: Position,
|
||||
pub dir: Direction,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue