From ffcd0000c2b421f81d5e43afb1727df08ca6c9e5 Mon Sep 17 00:00:00 2001 From: Alex Bethel Date: Tue, 7 Dec 2021 14:24:58 -0700 Subject: [PATCH] =?UTF-8?q?I=20made=20a=20cursed=20thing=20=F0=9F=98=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ablescript/src/variables.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index 1a7af9e7..47a3a1d3 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -206,7 +206,16 @@ impl Value { params: vec![], }, Value::Str(s) => Functio::Eval(s), - Value::Int(_) => todo!(), + Value::Int(i) => Functio::BfFunctio { + instructions: { + let instruction_mappings = [b'[', b']', b'+', b'-', b',', b'.', b'<', b'>']; + std::iter::successors(Some(i), |i| Some(i >> 3)) + .take_while(|&i| i != 0) + .map(|i| instruction_mappings[(i & 0x07) as usize]) + .collect() + }, + tape_len: crate::brian::DEFAULT_TAPE_SIZE_LIMIT, + }, Value::Bool(_) => todo!(), Value::Abool(_) => todo!(), Value::Functio(f) => f,