generated from PlexSheep/rs-base
Merge branch 'master' of https://git.cscherr.de/PlexSheep/wordle-analyzer
cargo devel CI / cargo CI (push) Successful in 41s
Details
cargo devel CI / cargo CI (push) Successful in 41s
Details
This commit is contained in:
commit
aba6c723da
|
@ -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}");
|
||||
|
|
|
@ -17,7 +17,7 @@ pub enum Error {
|
|||
},
|
||||
// for `FromStr` of `BuiltinSolver`
|
||||
#[error("Unknown builtin solver")]
|
||||
UnknownBuiltinSolver
|
||||
UnknownBuiltinSolver,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Error)]
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
Loading…
Reference in New Issue