Add Visualize to LayoutResult

This commit is contained in:
hal8174 2025-02-04 23:27:37 +01:00
parent ec869d4c18
commit c472a28591
5 changed files with 73 additions and 35 deletions

View file

@ -1,6 +1,6 @@
use crate::{LayoutInput, LayoutResult};
use factorio_core::prelude::*;
use factorio_pathfinding::{Connection, PathInput, Pathfinder, examples::HashMapMap};
use factorio_pathfinding::{Connection, examples::HashMapMap};
use rand::{Rng, seq::SliceRandom};
pub fn initally_set_blocks(
@ -137,7 +137,7 @@ pub fn mutate<R: Rng>(
#[allow(clippy::type_complexity)]
let r: &[(
&dyn Fn(&LayoutInput, &LayoutResult, &mut Vec<Block>, &mut R) -> bool,
&dyn Fn(&LayoutInput, &LayoutResult, &mut [Block], &mut R) -> bool,
_,
)] = &[
(&mutate_replace::<R>, 30),
@ -158,7 +158,7 @@ pub fn mutate<R: Rng>(
fn mutate_replace<R: Rng>(
input: &LayoutInput,
output: &LayoutResult,
blocks: &mut Vec<Block>,
blocks: &mut [Block],
rng: &mut R,
) -> bool {
let _ = input;
@ -205,7 +205,7 @@ fn mutate_replace<R: Rng>(
fn mutate_flip<R: Rng>(
input: &LayoutInput,
output: &LayoutResult,
blocks: &mut Vec<Block>,
blocks: &mut [Block],
rng: &mut R,
) -> bool {
let _ = output;
@ -229,7 +229,7 @@ fn mutate_flip<R: Rng>(
fn mutate_jiggle<R: Rng>(
input: &LayoutInput,
output: &LayoutResult,
blocks: &mut Vec<Block>,
blocks: &mut [Block],
rng: &mut R,
) -> bool {
let _ = input;