Skip to content

Commit

Permalink
fix: multiple fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
poyea authored Feb 26, 2022
1 parent 8606856 commit 88fe5ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poodle"
version = "0.4.0"
version = "0.5.0"
edition = "2021"
authors = ["John Law <[email protected]>"]
description = "Not a poodle, but a word-guessing game from your terminal"
Expand Down
9 changes: 4 additions & 5 deletions src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Keyboard {
.collect()
}

pub fn set(&mut self, state: &DayState, guess: &String) {
pub fn set_key_with_guess(&mut self, state: &DayState, guess: &String) {
'next: for res in state.stat.attempts.last().unwrap().slots.iter().zip(
guess
.chars()
Expand All @@ -59,10 +59,9 @@ impl Keyboard {
Result::Wrong => KeyState::Touched(Result::Wrong),
Result::Correct => KeyState::Touched(Result::Correct),
Result::Partial => match ch.used {
KeyState::Touched(Result::Wrong) | KeyState::Untouched => {
KeyState::Touched(Result::Partial)
}
KeyState::Touched(Result::Partial) => {
KeyState::Touched(Result::Wrong)
| KeyState::Untouched
| KeyState::Touched(Result::Partial) => {
KeyState::Touched(Result::Partial)
}
KeyState::Touched(Result::Correct) => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn start(today: String) {
if DayState::input_hygiene(&buffer) {
if DayState::input_allowed(&buffer, &allowed) {
let attempt_fmt = today_state.guess(&buffer);
keyboard.set(&today_state, &buffer);
keyboard.set_key_with_guess(&today_state, &buffer);
{
print!("\t\t{}", attempt_fmt);
io::stdout().flush().unwrap();
Expand All @@ -63,7 +63,7 @@ fn print_clear_console() {
}

pub fn exec(args: Cli) {
let today = "Feb 02, 2022".to_string();
let today = state::DayState::get_today();
print_clear_console();
println!("[{}] Hello poodler!", &today);
match args.cmd {
Expand Down

0 comments on commit 88fe5ed

Please sign in to comment.