From ad0bd8b3091bb79b1a5c0f79d662648f19aab808 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 21 Mar 2024 16:36:32 +0100 Subject: [PATCH] guess response --- src/game/mod.rs | 14 ++++++++++++++ src/game/response.rs | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/game/response.rs diff --git a/src/game/mod.rs b/src/game/mod.rs index db05b4b..327d01e 100644 --- a/src/game/mod.rs +++ b/src/game/mod.rs @@ -1,6 +1,10 @@ use crate::wlist::word::{Frequency, Solution, Word}; use crate::wlist::WordList; +use self::response::GuessResponse; + +pub mod response; + #[derive(Debug, Clone, PartialEq)] pub struct Game where @@ -44,6 +48,16 @@ impl 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 { + todo!() + } } /// Build and Configure a [`Game`] diff --git a/src/game/response.rs b/src/game/response.rs new file mode 100644 index 0000000..16ec22b --- /dev/null +++ b/src/game/response.rs @@ -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 +}