added brainfuck fibonacci

only works for single digit number a the moment
This commit is contained in:
overflowerror 2021-11-15 23:34:18 +01:00 committed by GitHub
parent 10c099212f
commit 8e45e34c9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

57
brainfuck/fib.bf Normal file
View file

@ -0,0 +1,57 @@
++++ number of iterations
>
++++++++++ dec 10 = \n
>
++++++++++++++++++++++++++++++++++++++++++++++++ dec 48 = 0
+.
<.>
.-
<.
>>
+ value 1
>
+ value 2
<<<<
[ iterate
-
>>>
[ copy value 1 to result
-
>>+
<<
]
>
[ add value 2 to result and set value 1
-
>+
<<
+
>
]
>
[ copy result to value 2 and to ascii
-
>+
<<+
>
]
<<<
[ calculate ascii value; use result for dec 30
-
>>>+
>+
<<<<
]
>>>
[ restore dec 30
-
<<<+
>>>
]
>.
[ reset ascii
-
]
<<<<<.
<
]