Improve power connection
This commit is contained in:
parent
2f637e1a82
commit
b4ab291884
2 changed files with 51 additions and 20 deletions
|
|
@ -1,12 +1,11 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
use factorio_blueprint::{BlueprintString, encode};
|
||||
use factorio_blueprint_generator::factory::{FactoryGraph, generate_factory};
|
||||
use factorio_core::prelude::*;
|
||||
use factorio_core::{prelude::*, visualize::Visualize};
|
||||
use factorio_layout::{genetic_algorithm_v1::GeneticAlgorithm, valid_layout::ValidLayout};
|
||||
use factorio_pathfinding::belt_finding::ConflictAvoidance;
|
||||
use rand::{SeedableRng, rngs::SmallRng};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
|
|
@ -25,7 +24,7 @@ fn main() {
|
|||
// .with_env_filter(EnvFilter::from_default_env())
|
||||
// .with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
|
||||
// .init();
|
||||
tracing_perfetto::install_perfetto_subscriber();
|
||||
// tracing_perfetto::install_perfetto_subscriber();
|
||||
|
||||
let text = std::fs::File::open(&args.path).unwrap();
|
||||
let factory_graph: FactoryGraph = serde_yaml::from_reader(text).unwrap();
|
||||
|
|
@ -41,10 +40,10 @@ fn main() {
|
|||
|
||||
let l = GeneticAlgorithm {
|
||||
mutation_retries: 20,
|
||||
population_size: 4,
|
||||
population_keep: 1,
|
||||
population_new: 1,
|
||||
generations: 5,
|
||||
population_size: 10,
|
||||
population_keep: 2,
|
||||
population_new: 2,
|
||||
generations: 4,
|
||||
valid_layout: l,
|
||||
};
|
||||
let p = ConflictAvoidance {
|
||||
|
|
@ -53,9 +52,11 @@ fn main() {
|
|||
|
||||
let mut rng = SmallRng::seed_from_u64(args.seed);
|
||||
|
||||
let b = BlueprintString::Blueprint(
|
||||
generate_factory(&l, &p, factory_graph, &mut rng).to_blueprint(),
|
||||
);
|
||||
let b = generate_factory(&l, &p, factory_graph, &mut rng);
|
||||
|
||||
b.print_visualization();
|
||||
|
||||
let b = BlueprintString::Blueprint(b.to_blueprint());
|
||||
|
||||
if args.json {
|
||||
println!("{}", serde_json::to_string_pretty(&b).unwrap());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue