use rand::prelude::SliceRandom; use rand::{Rng}; use crate::board::Letter; pub const GRID_LENGTH: u8 = 15; pub const TRAY_LENGTH: u8 = 7; pub const ALL_LETTERS_BONUS: u32 = 50; pub fn standard_tile_pool(rng: Option<&mut R>) -> Vec { let mut letters = Vec::new(); fn add_n_times(vector: &mut Vec, letter: Letter, n: usize) { for _ in 0..n { vector.push(letter); } } add_n_times(&mut letters, Letter::new(Some('A'), 1), 9); add_n_times(&mut letters, Letter::new(Some('B'), 3), 2); add_n_times(&mut letters, Letter::new(Some('C'), 3), 2); add_n_times(&mut letters, Letter::new(Some('D'), 2), 4); add_n_times(&mut letters, Letter::new(Some('E'), 1), 12); add_n_times(&mut letters, Letter::new(Some('F'), 4), 2); add_n_times(&mut letters, Letter::new(Some('G'), 2), 3); add_n_times(&mut letters, Letter::new(Some('H'), 4), 2); add_n_times(&mut letters, Letter::new(Some('I'), 1), 9); add_n_times(&mut letters, Letter::new(Some('J'), 8), 1); add_n_times(&mut letters, Letter::new(Some('K'), 5), 1); add_n_times(&mut letters, Letter::new(Some('L'), 1), 4); add_n_times(&mut letters, Letter::new(Some('M'), 3), 2); add_n_times(&mut letters, Letter::new(Some('N'), 1), 6); add_n_times(&mut letters, Letter::new(Some('O'), 1), 8); add_n_times(&mut letters, Letter::new(Some('P'), 3), 2); add_n_times(&mut letters, Letter::new(Some('Q'), 10), 1); add_n_times(&mut letters, Letter::new(Some('R'), 1), 6); add_n_times(&mut letters, Letter::new(Some('S'), 1), 4); add_n_times(&mut letters, Letter::new(Some('T'), 1), 6); add_n_times(&mut letters, Letter::new(Some('U'), 1), 4); add_n_times(&mut letters, Letter::new(Some('V'), 4), 2); add_n_times(&mut letters, Letter::new(Some('W'), 4), 2); add_n_times(&mut letters, Letter::new(Some('X'), 8), 1); add_n_times(&mut letters, Letter::new(Some('Y'), 4), 2); add_n_times(&mut letters, Letter::new(Some('Z'), 10), 1); add_n_times(&mut letters, Letter::new(None, 0), 2); if rng.is_some() { letters.shuffle(rng.unwrap()); } letters }