From e85f940218cf1ec874da90416d12b40b2ba76c43 Mon Sep 17 00:00:00 2001 From: yannickreiss Date: Wed, 20 Sep 2023 16:52:59 +0200 Subject: [PATCH] Basic math algorithms --- algorithms/basic_math.bf | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 algorithms/basic_math.bf diff --git a/algorithms/basic_math.bf b/algorithms/basic_math.bf new file mode 100644 index 0000000..5f4c5d7 --- /dev/null +++ b/algorithms/basic_math.bf @@ -0,0 +1,18 @@ +Assignment: cell(ptr x 1) = cell(ptr) +Using: cell(ptr); cell(ptr x 1); cell(ptr x 2) + +[ >+>+<<- ] >> [ << + >> - ] << + +Addition: cell(ptr) = cell(ptr) x cell(ptr x 1) +Using: cell(ptr); cell(ptr x 1) + +> [ <+>- ] < + +Subtraction: cell(ptr) = cell(ptr) _ cell(ptr x 1) +Using: cell(ptr); cell(ptr x 1) + +> [ <->- ] < + +Conditional: if (cell(ptr) greater 0) then do stuff + +[ > *do stuff here* < [-] ]