Skip to content

Instantly share code, notes, and snippets.

@deanveloper
Last active May 6, 2017 06:20
Show Gist options
  • Save deanveloper/ef71fc2d9101d0eb6e6558b86852a9b2 to your computer and use it in GitHub Desktop.
Save deanveloper/ef71fc2d9101d0eb6e6558b86852a9b2 to your computer and use it in GitHub Desktop.
>+[ loop (add 1 so the loop executes; keep #0 = 0)
, take input
[->+>+<<] copy into next two cells
>> go to 2nd copy
[-<<+>>] move value to original cell; makes "origin" & "copy"
<----- ----- subtract 10 from copy
note: copy's value is not relevant; all that matters is that if it is 0
(aka if the char was a newline) that it will break out of the loop!
this means that we can overwrite the copy with the next character; allowing
for the string to be stored neatly on the tape
]
< go to last inputted cell
[.<] keep outputting until the 0th cell is reached
>+[,[->+>+<<]>>[-<<+>>]<----------]<[.<]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment