#![allow(dead_code, unused)]

use std::env::args;

use game::{simulation::Simulation, Game};
use rand::seq::SliceRandom;
use solve::grouping::Grouping;

mod dictionnary;
mod game;
mod solve;

fn main() {
	let first_arg = args().nth(1);
	let dict = dictionnary::scrable(first_arg.clone().map(|w| w.len()).unwrap_or(7));
	let random_word = || dict.choose(&mut rand::thread_rng()).unwrap().to_string();
	let target = first_arg.unwrap_or_else(random_word);
	dbg!(&target);
	let solver = Grouping::new(dict);
	let mut game = Simulation::new(target);
	let result = game.play_all(solver, Some(20));
	println!("{result:?}");
}
