guess response

This commit is contained in:
Christoph J. Scherr 2024-03-21 16:36:32 +01:00
parent a3e348ba91
commit ad0bd8b309
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
2 changed files with 27 additions and 0 deletions

View File

@ -1,6 +1,10 @@
use crate::wlist::word::{Frequency, Solution, Word}; use crate::wlist::word::{Frequency, Solution, Word};
use crate::wlist::WordList; use crate::wlist::WordList;
use self::response::GuessResponse;
pub mod response;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct Game<WL> pub struct Game<WL>
where where
@ -44,6 +48,16 @@ impl<WL: WordList> Game<WL> {
Ok(game) Ok(game)
} }
pub fn reset(mut self) -> Self {
self.solution = self.wordlist.rand_solution();
self.step = 0;
self
}
pub fn guess(&mut self, word: Word) -> anyhow::Result<GuessResponse> {
todo!()
}
} }
/// Build and Configure a [`Game`] /// Build and Configure a [`Game`]

13
src/game/response.rs Normal file
View File

@ -0,0 +1,13 @@
use crate::wlist::word::Word;
pub struct GuessResponse {
guess: Word,
status: Vec<(char,Status)>
step: usize
}
pub enum Status {
None,
Exists,
Matched
}