rustle-game 0.1.0

Play wordle and nerdle in your terminal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::io::{BufRead, BufReader};
use std::fs;
use rand::seq::IteratorRandom; // 0.7.3


static WORDS: &'static str = include_str!("../words.txt");


pub fn play(n: u8) -> String {
    WORDS.lines()
        .filter(|word| word.len() == n as usize)
        .choose(&mut rand::thread_rng())
        .unwrap()
        .to_string()
}