i read homestuck ;-;

This commit is contained in:
Emi Simpson 2024-04-24 20:38:53 -04:00
parent 13a2eb6d36
commit 22146b5b5c
Signed by: Emi
GPG key ID: A12F2C2FFDC3D847
3 changed files with 22 additions and 5 deletions

2
Cargo.lock generated
View file

@ -94,7 +94,7 @@ dependencies = [
[[package]]
name = "dw"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"chbs",
]

View file

@ -1,6 +1,6 @@
[package]
name = "dw"
version = "0.1.0"
version = "0.1.1"
authors = ["Emi Simpson <emi@alchemi.dev>"]
edition = "2018"

View file

@ -1,16 +1,33 @@
use chbs::{component::{phrase::BasicPhraseBuilder, word::{FixedWordSetProvider, WordCapitalizer}}, probability::Probability, scheme::Scheme, word::WordList};
use chbs::{component::{phrase::BasicPhraseBuilder, word::{FixedWordSetProvider, WordCapitalizer}}, entropy::{Entropy, HasEntropy}, prelude::WordStyler, probability::Probability, scheme::Scheme, word::WordList};
fn main() {
let wordlist = WordList::builtin_eff_general_short();
let provider = FixedWordSetProvider::new(wordlist.sampler(), 6);
let styler = WordCapitalizer::new(Probability::half(), Probability::half());
let capitalizer = WordCapitalizer::new(Probability::Sometimes(0.3), Probability::Sometimes(0.8));
let builder = BasicPhraseBuilder::new("".into());
let scheme = Scheme::new(
Box::new(provider),
vec![Box::new(styler)],
vec![Box::new(capitalizer), Box::new(Terezifier{})],
Box::new(builder),
Vec::new(),
);
println!("{}", scheme.generate());
}
#[derive(Debug)]
struct Terezifier {}
impl WordStyler for Terezifier {
fn style_word(&self, word: String) -> String {
word.replace(&['i', 'I'], "1")
.replace(&['e', 'E'], "3")
.replace(&['a', 'A'], "4")
}
}
impl HasEntropy for Terezifier {
fn entropy(&self) -> Entropy {
Entropy::one()
}
}