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(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}");
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
Loading…
Reference in New Issue