Random , where the Game will make up random shit on the fly, give it randomized names made out of random Syllables and you have no Idea what each Ore is, until you experiment with it.
ore.7z (751.3 KB)
use rand::{prelude::ThreadRng, seq::SliceRandom, thread_rng};
use lazy_static::lazy_static;
lazy_static!{
static ref VOVELS: Vec<&'static str> = vec![
"i", "e", "u", "a", "ee", "ea", "ie", "ou", "er", "or", "o", "ir", "ur", "ear", "our", "ar",
"al", "au", "ae", "oar", "oo", "ui", "ew", "a", "eigh", "ow", "oa", "oi", "oy", "eer",
"ere", "are", "air", "oor",
];
static ref CONSTONANTS: Vec<&'static str> = vec![
"b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x",
"y", "z",
];
static ref TEMPLATE: Vec<&'static str> = vec!["cv", "vc", "cvc"];
}
fn gen_syllable(rng: &mut ThreadRng) -> String {
let choose=TEMPLATE.choose(rng).unwrap();
let mut output=String::new();
for c in choose.chars(){
if c=='c'{
output+=*CONSTONANTS.choose(rng).unwrap();
}else{
output+=*VOVELS.choose(rng).unwrap();
}
}
output
}
fn gen_name(len: i32,rng: &mut ThreadRng) -> String {
let mut str = String::new();
for _ in 0..len {
str += &gen_syllable(rng);
}
str+"ite"
}
fn main() {
let mut rng = thread_rng();
println!("{}", gen_name(2, &mut rng));
}