Merge branch 'master' of https://git.cscherr.de/PlexSheep/wordle-analyzer
cargo devel CI / cargo CI (push) Successful in 41s Details

This commit is contained in:
Christoph J. Scherr 2024-03-22 14:55:09 +01:00
commit aba6c723da
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
5 changed files with 12 additions and 11 deletions

View File

@ -1,14 +1,12 @@
#![warn(clippy::all)]
// #![warn(missing_docs)]
#![warn(missing_debug_implementations)]
use std::io::Write;
use clap::Parser;
use libpt::log::*;
use wordle_analyzer::error::GameError;
use wordle_analyzer::game::response::GuessResponse;
use wordle_analyzer::game::Game;
use wordle_analyzer::solve::{stupid, BuiltinSolvers, Solver};
use wordle_analyzer::wlist::builtin::BuiltinWList;
use wordle_analyzer::wlist::word::Word;
@ -49,17 +47,15 @@ fn main() -> anyhow::Result<()> {
.max_steps(cli.max_steps)
.precompute(cli.precompute);
let solver = match cli.solver {
BuiltinSolvers::Naive => {
stupid::StupidSolver::build(&wl)?
},
_ => todo!()
BuiltinSolvers::Naive => stupid::StupidSolver::build(&wl)?,
_ => todo!(),
};
let mut game = builder.build()?;
debug!("{game:#?}");
let mut response: GuessResponse;
let mut guess: Word;
let mut _guess: Word;
loop {
response = solver.play(&mut game)?;
println!("{response}");

View File

@ -17,7 +17,7 @@ pub enum Error {
},
// for `FromStr` of `BuiltinSolver`
#[error("Unknown builtin solver")]
UnknownBuiltinSolver
UnknownBuiltinSolver,
}
#[derive(Debug, Clone, Error)]

View File

@ -183,7 +183,7 @@ impl<'wl, WL: WordList> GameBuilder<'wl, WL> {
length: super::DEFAULT_WORD_LENGTH,
precompute: false,
max_steps: super::DEFAULT_MAX_STEPS,
wordlist: wl
wordlist: wl,
}
}

View File

@ -25,7 +25,11 @@ pub enum Status {
}
impl GuessResponse {
pub(crate) fn new<WL: WordList>(guess: Word, status: Vec<(char, Status)>, game: &Game<WL>) -> Self {
pub(crate) fn new<WL: WordList>(
guess: Word,
status: Vec<(char, Status)>,
game: &Game<WL>,
) -> Self {
let finish: bool = if game.step() > game.max_steps() {
true
} else {

View File

@ -0,0 +1 @@