Skip to content

Instantly share code, notes, and snippets.

@RyanScottLewis
Created December 8, 2012 17:50
Show Gist options
  • Save RyanScottLewis/4241164 to your computer and use it in GitHub Desktop.
Save RyanScottLewis/4241164 to your computer and use it in GitHub Desktop.
RESET
+++++ +++++ set cell 0 to 10 (the multiplier)
[ run brackets until cell 0 == 0
> +++++ +++ point to and set cell 1 to 8 * 10 = 80
> +++++ +++++ ++ point to and set cell 2 to 12 * 10 = 120
> +++++ ++++ point to and set cell 3 to 9 * 10 = 90
> +++++ +++++ + point to and set cell 4 to 11 * 10 = 110
<<<< - point to and cell 0 decrement 1
]
> ++ . point to cell 1 increment 2 and print
> + . point to cell 2 increment 1 and print
> +++++ ++ . point to cell 3 increment 7 and print
> . point to cell 4 and print
<<<< point to cell 0
clean up - loop through and set all cells to 0:
+++++ +++++ set cell 0 to 10 (the multiplier)
[ run brackets until cell 0 == 0
> ----- --- point to cell 1 and decrement 8
> ----- ----- -- point to cell 2 and decrement 12
> ----- ---- point to cell 3 and decrement 9
> ----- ----- - point to cell 41 and decrement 11
<<<< - point to and cell 0 decrement 1
]
> -- point to cell 1 decrement 2
> - point to cell 2 decrement 1
> ----- -- point to cell 3 decrement 7
<<< point to cell 0
@RyanScottLewis
Copy link
Author

http://repl.it/ - Brainfuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment