This commit is contained in:
Matthieu Jolimaitre 2024-10-25 19:20:11 +02:00
commit b130df0391
16 changed files with 339925 additions and 0 deletions

35
src/bench.rs Normal file
View file

@ -0,0 +1,35 @@
#![allow(dead_code, unused)]
// use core::iter::repeat;
use game::{simulation::Simulation, Game};
use rand::seq::SliceRandom;
use rayon::iter::repeat;
use rayon::prelude::*;
use solve::grouping::Grouping;
use std::env::args;
mod dictionnary;
mod game;
mod solve;
fn main() {
let count = args()
.nth(1)
.map(|s| s.parse().expect("Number expected."))
.unwrap_or(100);
// let dict = dictionnary::francais(7);
let dict = dictionnary::gutenberg(7);
(0..count).into_par_iter().for_each(|_| {
let target = dict.choose(&mut rand::thread_rng()).unwrap().to_string();
dbg!(&target);
let solver = Grouping::new(dict.clone());
let mut game = Simulation::new(target.clone());
let result = game.play_all(solver, Some(20));
match result {
Ok((_, tries)) => println!("succ,{target},{tries}"),
Err(reason) => println!("fail,{target},{reason}"),
};
});
}
// fail,suedois,Reached limit.