show number of words in dictionary
This commit is contained in:
parent
42290371eb
commit
6c709c59dc
1 changed files with 7 additions and 6 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -9,6 +9,12 @@ use crate::letterset::LetterSet;
|
||||||
mod letterset;
|
mod letterset;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let search_limit = env::args()
|
||||||
|
.nth(1)
|
||||||
|
.and_then(|n| n.parse::<usize>().ok())
|
||||||
|
.unwrap_or(1000);
|
||||||
|
eprintln!("search depth: {search_limit}");
|
||||||
|
|
||||||
let mut dictionary: Vec<_> = BufReader::new(io::stdin().lock())
|
let mut dictionary: Vec<_> = BufReader::new(io::stdin().lock())
|
||||||
.lines()
|
.lines()
|
||||||
.map(|line| {
|
.map(|line| {
|
||||||
|
|
@ -17,13 +23,8 @@ fn main() {
|
||||||
(word, ls)
|
(word, ls)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
eprintln!("words: {}", dictionary.len());
|
||||||
|
|
||||||
let search_limit = env::args()
|
|
||||||
.nth(1)
|
|
||||||
.and_then(|n| n.parse::<usize>().ok())
|
|
||||||
.unwrap_or(1000);
|
|
||||||
|
|
||||||
eprintln!("search depth: {search_limit}");
|
|
||||||
let Some((len, path)) = solve(&mut dictionary, search_limit) else {
|
let Some((len, path)) = solve(&mut dictionary, search_limit) else {
|
||||||
println!("failed :(");
|
println!("failed :(");
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue