diff --git a/server/src/img.rs b/server/src/img.rs index 36b76d95..a1b15953 100644 --- a/server/src/img.rs +++ b/server/src/img.rs @@ -5,6 +5,7 @@ use rand::distributions::{Normal, WeightedIndex}; use std::fs::copy; use std::fs::File; use std::io::prelude::*; +use std::char::from_u32; use failure::Error; use failure::err_msg; @@ -83,18 +84,39 @@ pub fn invader_write(id: Uuid) -> Result { Ok(id) } +fn hieroglyph() -> String { + let mut rng = thread_rng(); -// #[cfg(test)] -// mod tests { -// use super::*; + let mut s = String::new(); + for i in 0..4 { + s.push(from_u32(rng.gen_range(0x13000, 0x1342E)).unwrap()); + if i == 1 { + // newline + s.push(from_u32(0x000a).unwrap()); + } + } -// #[test] -// fn invader_img_test() { -// for i in 0..100 { -// invader_img_write(Uuid::new_v4()).unwrap(); -// } -// } -// } + // println!("{:}", s); + return s; +} + + +#[cfg(test)] +mod tests { + use super::*; + + // #[test] + // fn invader_img_test() { + // for i in 0..100 { + // invader_img_write(Uuid::new_v4()).unwrap(); + // } + // } + + #[test] + fn hieroglyph_test() { + hieroglyph(); + } +} diff --git a/server/src/names.rs b/server/src/names.rs index cf32e466..a85cff65 100644 --- a/server/src/names.rs +++ b/server/src/names.rs @@ -1,13 +1,14 @@ use rand::prelude::*; use rand::{thread_rng}; -const FIRSTS: [&'static str; 42] = [ +const FIRSTS: [&'static str; 44] = [ "artificial", "ambient", "borean", "brewing", "bristling", "compressed", + "ceramic", "chromatic", "concave", "convex", @@ -40,18 +41,20 @@ const FIRSTS: [&'static str; 42] = [ "rogue", "subversive", "subterranean", + "subsonic", "synthetic", "sweet", "terrestrial", "weary", ]; -const LASTS: [&'static str; 49] = [ +const LASTS: [&'static str; 48] = [ "artifact", "assembly", "carbon", "console", "construct", + "craft", "design", "drone", "distortion", @@ -82,7 +85,6 @@ const LASTS: [&'static str; 49] = [ "receiver", "replicant", "river", - "river", "scaffold", "structure", "shape", @@ -95,7 +97,6 @@ const LASTS: [&'static str; 49] = [ "vibration", "warning", "wildlife", - "witness", ]; pub fn name() -> String { @@ -110,4 +111,4 @@ pub fn name() -> String { s.push_str(LASTS[last]); s -} \ No newline at end of file +}