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

View File

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

View File

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

View File

@ -25,7 +25,11 @@ pub enum Status {
} }
impl GuessResponse { 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() { let finish: bool = if game.step() > game.max_steps() {
true true
} else { } else {

View File

@ -0,0 +1 @@