///Finds the word which when guessed
///will cause the largest possible bucket to be smallest
///it will return that word's ID
///This word I call an sm_word here, hence the name of the function.
Finds the word which when guessed
will cause the largest possible bucket to be smallest
it will return that word's ID
This word I call an sm_word here, hence the name of the function.
Finds the word which when guessed will cause the largest possible bucket to be smallest it will return that word ' s ID This word I call an sm_word here hence the name of the function .
fn sm_word(left: &[WordId], gbank: WordBank, sbank: WordBank) -> WordId {
    //for every possible guess, find the bucket for every word left
    //choose the guess which makes it's largest bucket for every solution word smallest
    (0..gbank.len())
        .into_par_iter()
        .min_by_key(|&guess| {
            let out = left
                .iter()
                .map(|&possible_solution| {
                    bucket(
                        guess,
                        possible_solution,
                        solution_compare,
                        left,
                        gbank,
                        sbank,
                    )
                    .len()
                })
                .max()
                .unwrap();
            //commented out, though this can be a nice thing for peace of mind when running longer
            //computations
            //if guess % 50 == 0 { eprintln!("finished guess {}", guess); }
            out
        })
        .unwrap()
}
fn sm_word ( left : & [ WordId ] , gbank : WordBank , sbank : WordBank ) -> WordId { //for every possible guess, find the bucket for every word left //choose the guess which makes it's largest bucket for every solution word smallest ( 0 .. gbank . len ( ) ) . into_par_iter ( ) . min_by_key ( | & guess | { let out = left . iter ( ) . map ( | & possible_solution | { bucket ( guess , possible_solution , solution_compare , left , gbank , sbank , ) . len ( ) } ) . max ( ) . unwrap ( ) ; //commented out, though this can be a nice thing for peace of mind when running longer //computations //if guess % 50 == 0 { eprintln!("finished guess {}", guess); } out } ) . unwrap ( ) }
Finds the word which when guessed
will cause the largest possible bucket to be smallest
it will return that word's ID
This word I call an sm_word here, hence the name of the function.
Finds the word which when guessed will cause the largest possible bucket to be smallest it will return that word ' s ID This word I call an sm_word here hence the name of the function .
left
&[WordId]
gbank
WordBank
sbank
WordBank