use cyberknight::{User, WordBank}; fn main() { println!("Hello, world!");/* if let Some(u) = User::load(127) { println!("Name: {:?}", u.name); println!("Password: ({}) {}", u.password_cost(), u.password); if u.verify_password("password") { println!("Password: Verified"); } else { println!("Password: Invalid"); } println!("Ip: {}", u.ip); println!("Ports: ({}) {:?}", u.ports.len(), u.ports); } else { let mut u: User = User::new("Bob".to_string(), 127); u.set_password("password"); u.ip.3 = 1; println!("Name: {:?}", u.name); println!("Password: ({}) {}", u.password_cost(), u.password); println!("Ip: {}", u.ip); println!("Ports: ({}) {:?}", u.ports.len(), u.ports); u.save(); }*/ if let Some(wb) = WordBank::load() { println!("{} Words", wb.words.len()); let mut sum: usize = 0; let mut idx: usize = 0; for word in wb.words.iter() { let diff = wb.get_difficulty(idx); if diff != word.len() { println!("{:4}: {:30} diff={:3} len={}", idx, word, diff, word.len()); } else { println!("{:4}: {:30} diff={}", idx, word, diff); } sum += diff; idx += 1; } println!("Average Difficulty: {:.2}", sum as f32 / wb.words.len() as f32); } }