A little wierd thing I wrote when I was bored (its rust code). But I found it funny. Its my attempt at (fan) “art” maybe?
use std::any::Any;
use std::net::TcpStream;
use std::collections::HashMap;
use rand::{thread_rng, Rng};
use stargate::Nanite;
use periodic_table_rs::TECHNETIUM;
use mind_lib::{Perceptions, Memory};
use simple_octree::Octree;
use supporters::People;
type Brain<P, M> = HashMap<P, M>;
#[derive(Clone)]
struct Greg {
body: Octree<dyn Any + Nanite<TECHNETIUM>>,
variant: GregFlavour,
backup_nanites: Vec<dyn Any + Nanite<TECHNETIUM>>,
memory: Brain<Perceptions, Memory>,
}
enum GregFlavour {
ClassicGregorius,
ModernGregorius,
Gregory,
Gregoriette,
RedFoxForm,
MetalSlimeForm,
}
fn main() {
let the_greg = Greg::from("https://mechaenetia.com/greg/");
let gregs: Vec<Box<Greg>> = {
let mut gregs = Vec::new();
for _ in 0..42 {
let greg_in_a_box = Box::new(the_greg.clone());
gregs.push(greg_in_a_box);
}
gregs
};
println!("Everyone will receive their own clone of greg in 3, 2, 1 ...");
gregs.into_iter().map(
|greg_in_a_box: Box<Greg>|
TcpStream::connect(thread_rng().gen::<People>()).unwrap().write(greg_in_a_box)
).collect();
}
It does not compile though…