diff --git a/Cargo.lock b/Cargo.lock index 294d3b8..358b73f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "owo-colors" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20448fd678ec04e6ea15bbe0476874af65e98a01515d667aa49f1434dc44ebf4" - [[package]] name = "wordlers" version = "0.1.0" -dependencies = [ - "owo-colors", -] diff --git a/Cargo.toml b/Cargo.toml index 0c35b5a..d36269e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -owo-colors = "3.2.0" +# owo-colors = "3.2.0" diff --git a/src/main.rs b/src/main.rs index 50d212f..6d59968 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,9 +8,17 @@ fn main() { .map(|word| word.trim().to_lowercase()) .collect::>(); - let mut exact = "ak.."; - let mut close: Vec<(char, usize)> = vec![('a', 2)]; - let mut banned = "ponieu"; + let exact = ".u..."; + let close: Vec<(char, usize)> = vec![ + ('.', 0), + ('m', 0), + ('o', 1), + ('h', 2), + ('u', 3), + ('r', 2), + ('o', 4), + ]; + let banned = "ptbenisa"; words = words .iter() @@ -43,10 +51,11 @@ fn check_exact(word: &String, exact: &str) -> bool { } fn check_close(word: &String, close: &Vec<(char, usize)>) -> bool { - let mut w = word.chars(); - for (character, index) in close { - if character.to_owned() == w.nth(index - 1).unwrap() { + if *character == '.' { + continue; + } + if *character == word.chars().nth(*index).unwrap() { return false; } } @@ -73,10 +82,9 @@ fn word_value(word: &String) -> usize { } } - // TODO: reimplement after needs uses letter index - // if word.chars().last().unwrap() == 's' { - // value = value + 3; - // } + if word.chars().last().unwrap() == 's' { + value = value + 3; + } return value; }