wordle_strategies/strategies/
common_easy.rs

1use std::fmt::Display;
2
3use itertools::Itertools;
4use lazy_static::lazy_static;
5use wordle_rs::{
6    strategy::{Attempts, AttemptsKey, Puzzle},
7    Strategy,
8};
9
10use crate::util::occurrences;
11
12/// An easymode Wordle strategy that works the same way as
13/// [Common](crate::Common) but makes calculated easymode guesses.
14#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
15#[doc(hidden)]
16pub struct CommonEasy;
17
18impl Strategy for CommonEasy {
19    fn solve(&self, _puzzle: &mut Puzzle, _key: AttemptsKey) -> Attempts {
20        lazy_static! {
21            static ref SORTED: Vec<&'static str> = {
22                let mut words = Vec::from(wordle_rs::words::GUESSES);
23                words.sort_unstable_by_key(|s: &&str| {
24                    -s.chars()
25                        .unique()
26                        .map(|c| occurrences(c) as i32)
27                        .sum::<i32>()
28                });
29                words
30            };
31        }
32
33        //let mut attempts = Attempts::new();
34        //let mut info = Information::new();
35
36        // attempts
37        // todo!("{:?}", puzzle)
38        todo!()
39    }
40
41    fn version(&self) -> &'static str {
42        "0.1.0"
43    }
44
45    fn hardmode(&self) -> bool {
46        false
47    }
48}
49
50impl Display for CommonEasy {
51    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52        write!(f, "wordle_strategies::CommonEasy")
53    }
54}