names and hiero

This commit is contained in:
ntr 2019-07-29 12:20:56 +10:00
parent e5c8b78ec1
commit 1940c437b0
2 changed files with 38 additions and 15 deletions

View File

@ -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,10 +84,26 @@ pub fn invader_write(id: Uuid) -> Result<Uuid, Error> {
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());
}
}
// println!("{:}", s);
return s;
}
#[cfg(test)]
mod tests {
use super::*;
// #[test]
// fn invader_img_test() {
@ -94,7 +111,12 @@ pub fn invader_write(id: Uuid) -> Result<Uuid, Error> {
// invader_img_write(Uuid::new_v4()).unwrap();
// }
// }
// }
#[test]
fn hieroglyph_test() {
hieroglyph();
}
}

View File

@ -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 {