Add blueprints directory and generalize benchmark and tests.

This commit is contained in:
hal8174 2024-01-08 19:35:04 +01:00
parent 96a86779f4
commit 02e65f6fe3
12 changed files with 75 additions and 38 deletions

View file

@ -7,11 +7,13 @@ use factorio_blueprint::belt_finding::brute_force::{problems, Bruteforce};
enum Mode {
Solutions,
Step,
Statistics,
}
#[derive(ValueEnum, Clone)]
enum Problem {
Simple,
Mid,
Snake,
Weaving,
}
@ -20,6 +22,7 @@ impl Problem {
fn get_problem(&self) -> Bruteforce {
match self {
Problem::Simple => problems::simple(),
Problem::Mid => problems::mid(),
Problem::Snake => problems::snake(),
Problem::Weaving => problems::weaving(),
}
@ -47,7 +50,7 @@ fn main() {
println!("{}\n{}\n{}", b.count(), b.solution_count(), b);
}
println!("{}\n{}", b.count(), b.solution_count());
println!("Solutions: {}\nStates: {}", b.solution_count(), b.count());
}
Mode::Step => {
while b.next_state() {
@ -55,7 +58,12 @@ fn main() {
let mut s = String::new();
let _ = io::stdin().read_line(&mut s);
}
println!("{}\n{}", b.count(), b.solution_count());
println!("Solutions: {}\nStates: {}", b.solution_count(), b.count());
}
Mode::Statistics => {
while b.next_finish_state() {}
println!("Solutions: {}\nStates: {}", b.solution_count(), b.count());
}
}