diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index 11e2d6a..241654b 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -218,8 +218,25 @@ impl Value { }, tape_len: crate::brian::DEFAULT_TAPE_SIZE_LIMIT, }, - Value::Bool(_) => todo!(), - Value::Abool(_) => todo!(), + Value::Bool(b) => Functio::Eval( + 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::()) + } + Abool::Always => r#"loop{"Buy Able products!"print;}"#.to_owned(), + }), Value::Functio(f) => f, Value::Cart(_) => todo!(), }