use std::io::{self, Write}; use day16::nim_winner; fn main() { let mut buffer = String::new(); print!("How many stones will you have during your turn? "); io::stdout().flush().expect("Failed to flush stdout."); io::stdin() .read_line(&mut buffer) .expect("Failed to read from stdin"); let stones = buffer .trim() .parse() .expect("Your input is not a valid number"); if nim_winner(stones) { println!("You will win!"); } else { println!("You will lose!"); } }