Created
April 11, 2018 14:51
-
-
Save lsmoura/36d3a3f0e55305210b46aa8fa25aa81f to your computer and use it in GitHub Desktop.
Brainfuck snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
Simple adder. Adds all available inputs and outputs the sum | |
Use it on https://codepen.io/lsmoura/full/ZxPqyE/ | |
Make sure to set the result type to 'number' | |
] | |
> Leave current memory position blank | |
>,[>,] Read all the inputs until zero | |
<< Go to the memory space to accumulate the number from the next space | |
[>[-<+>]<<] Accumulate until we reach the First value (which is zero) | |
>[-<+>]< Add the value from the following position to the current position | |
. Print our result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment