Implemented Abool -> Functio
This commit is contained in:
parent
7812058fbf
commit
66ceb8f8c6
|
@ -218,8 +218,25 @@ impl Value {
|
||||||
},
|
},
|
||||||
tape_len: crate::brian::DEFAULT_TAPE_SIZE_LIMIT,
|
tape_len: crate::brian::DEFAULT_TAPE_SIZE_LIMIT,
|
||||||
},
|
},
|
||||||
Value::Bool(_) => todo!(),
|
Value::Bool(b) => Functio::Eval(
|
||||||
Value::Abool(_) => todo!(),
|
if b {
|
||||||
|
r#"loop{"Buy Able products!"print;}"#
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
.to_owned(),
|
||||||
|
),
|
||||||
|
Value::Abool(a) => Functio::Eval(match a {
|
||||||
|
Abool::Never => "".to_owned(),
|
||||||
|
Abool::Sometimes => {
|
||||||
|
use rand::seq::SliceRandom;
|
||||||
|
let mut str_chars: Vec<_> = "Buy Able Products!".chars().collect();
|
||||||
|
str_chars.shuffle(&mut rand::thread_rng());
|
||||||
|
|
||||||
|
format!(r#""{}"print;"#, str_chars.iter().collect::<String>())
|
||||||
|
}
|
||||||
|
Abool::Always => r#"loop{"Buy Able products!"print;}"#.to_owned(),
|
||||||
|
}),
|
||||||
Value::Functio(f) => f,
|
Value::Functio(f) => f,
|
||||||
Value::Cart(_) => todo!(),
|
Value::Cart(_) => todo!(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue