Created
September 7, 2011 00:14
-
-
Save Reinmar/1199370 to your computer and use it in GitHub Desktop.
Brainfuck
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
for(b=[],o='',i=c=l=0;u=s[i++];)l<0?u==']'&&l++:(b.push(0),u=='['?(l=b[c]?i-1:-1):u==']'?i=l:u=='.'?o+=b[c]:u=='+'?++b[c]:u=='-'?--b[c]:u=='>'?++c:u=='<'?--c:o) |
30 bytes is impossible - i tried and i'm nearly sure about that. But I wrote version without loops:
for(b=[],o='',i=c=0;u=s[i];)b[i++]=0,u=='.'?o+=b[c]:u=='+'?++b[c]:u=='-'?--b[c]:u=='>'?++c:u=='<'?--c:o
103 chars
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you can save some more 30 bytes, may be this will be the coolest code on 140byt.es!!