clean up main
This commit is contained in:
parent
7e2fa309cd
commit
76ff849a8c
1 changed files with 1 additions and 10 deletions
11
src/main.rs
11
src/main.rs
|
@ -1,5 +1,4 @@
|
|||
use std::convert::TryInto;
|
||||
use rand::seq::SliceRandom;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! word {
|
||||
|
@ -24,8 +23,6 @@ mod evaluator;
|
|||
|
||||
|
||||
fn play<const N: usize>(dictionary: &Dictionary<N>) {
|
||||
let secret = *dictionary.choose(&mut rand::thread_rng()).unwrap();
|
||||
println!("The secret is {:?}", secret);
|
||||
let mut constraints = constraints::Total::new();
|
||||
let mut game = game::Game {
|
||||
evaluator: &mut evaluator::AdversarialEvaluator::new(dictionary),
|
||||
|
@ -43,13 +40,7 @@ fn play<const N: usize>(dictionary: &Dictionary<N>) {
|
|||
fn load_words<const N: usize>(contents: &'static str) -> Vec<Word<N>> {
|
||||
contents
|
||||
.split("\n")
|
||||
.map(|line|
|
||||
line.chars()
|
||||
.collect::<Vec<char>>()
|
||||
.as_slice()
|
||||
.try_into()
|
||||
.unwrap()
|
||||
)
|
||||
.map(|line| word!(line))
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue