if (x) { code1 } else { code2 } =============================== tmp[-]+ x[ { code1 for x>0 } tmp- x[-] { side-effect: x gets zeroed } ] tmp[ { code2 for x == 0 } tmp ] Short ----- tmp[-]+x[ { code1 for x>0 } tmp-x[-]]tmp[ { code2 for x == 0 } tmp] Alternative without loss of x: ------------------------------ tmp[-]+ tx[-] x[ { code1 for x>0 } tmp- { save x } x[tx+x-] ] { restore x } tx[x+tx-] tmp[ { code2 for x == 0 } tmp ] Short ----- tmp[-]+tx[-]x[ { code1 for x>0 } tmp-x[tx+x-]]tx[x+tx-]tmp[ { code2 for x == 0 } tmp] Vergleich --------- Daniel Marschall (32 ops): a[-]+b[-]x[ code1 a-x[b+x-]]b[x+b-]a[ code2 a] Jeffry Johnston (39 ops): http://esolangs.org/wiki/brainfuck_algorithms a[-]b[-]x[a+b+x-]a[x+a-]+b[ code1 a-b[-]]a[ code2 a-] Abgeleitet: if (x==0) { code } ============================== Daniel Marschall (32 ops): a[-]+b[-]x[a-x[b+x-]]b[x+b-]a[ code a] Jeffry Johnston (39 ops): http://esolangs.org/wiki/brainfuck_algorithms a[-]b[-]x[a+b+x-]a[x+a-]+b[a-b[-]]a[ code a-] y=x === x->y: function moveXtoY(x, y) { # y[-]x[y+x-] { y=x } { x=0 } y[-] x[ y+ x- ] } Info ==== Erlaubt: x[ { code } x] NICHT erlaubt x[ { code } tmp ]y Grund ----- - Wenn x>0, dann endet schleife mit pos=tmp - Wenn x=0, dann endet schleife mit pos=x => Es ist unbekannt, wie man gehen muss, um zu pos=y zu gelangen