moar attributes
cargo devel CI / cargo CI (push) Successful in 40s Details

This commit is contained in:
Christoph J. Scherr 2024-03-21 11:23:44 +01:00
parent 6c267b66a5
commit 76453dedf6
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
4 changed files with 25 additions and 13 deletions

View File

@ -1,6 +1,9 @@
#![warn(clippy::all)]
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
use clap::Parser; use clap::Parser;
use libpt::log::*; use libpt::log::*;
use wordle_analyzer::{game,self}; use wordle_analyzer::{self, game};
#[derive(Parser, Clone, Debug)] #[derive(Parser, Clone, Debug)]
#[command(version, about, long_about, author)] #[command(version, about, long_about, author)]
@ -13,7 +16,7 @@ struct Cli {
length: usize, length: usize,
/// how many times can we guess? /// how many times can we guess?
#[arg(short, long, default_value_t = wordle_analyzer::DEFAULT_MAX_STEPS)] #[arg(short, long, default_value_t = wordle_analyzer::DEFAULT_MAX_STEPS)]
max_steps: usize max_steps: usize,
} }
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
@ -23,7 +26,8 @@ fn main() -> anyhow::Result<()> {
let game = game::Game::builder() let game = game::Game::builder()
.length(cli.length) .length(cli.length)
.precompute(cli.precompute).build()?; .precompute(cli.precompute)
.build()?;
Ok(()) Ok(())
} }
@ -31,8 +35,10 @@ fn main() -> anyhow::Result<()> {
fn get_word(cli: &Cli) -> String { fn get_word(cli: &Cli) -> String {
let mut word = String::new(); let mut word = String::new();
todo!("get user input"); // TODO: get user input
todo!("validate user input"); // TODO: validate user input
todo!();
assert_eq!(word.len(), cli.length); assert_eq!(word.len(), cli.length);
word word

View File

@ -0,0 +1,6 @@
#![warn(clippy::all)]
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
fn main() {
unimplemented!();
}

View File

@ -1,3 +1,4 @@
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Game { pub struct Game {
length: usize, length: usize,
precompute: bool, precompute: bool,
@ -42,14 +43,7 @@ impl Game {
} }
} }
impl Default for Game { #[derive(Debug, Clone, PartialEq, Eq, Hash)]
fn default() -> Self {
GameBuilder::default()
.build()
.expect("could not build game with defaults")
}
}
pub struct GameBuilder { pub struct GameBuilder {
length: usize, length: usize,
precompute: bool, precompute: bool,

View File

@ -1,4 +1,10 @@
#![warn(clippy::all)]
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
/// Default letters of a solution word
pub const DEFAULT_WORD_LENGTH: usize = 5; pub const DEFAULT_WORD_LENGTH: usize = 5;
/// Default amount of guesses per game
pub const DEFAULT_MAX_STEPS: usize = 6; pub const DEFAULT_MAX_STEPS: usize = 6;
pub mod game; pub mod game;