In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

283 <- 377 forked from: Shorten Brainf*ck Interpreter

Get Adobe Flash player
by bkzen 27 Oct 2010

    Talk

    keim_at_Si at 03 Jun 2011 05:46
    ”,” コマンドは処理してない?
    bkzen at 03 Jun 2011 19:37
    ", ” 無しバージョンのようです

    Tags

    Embed
/**
 * Copyright bkzen ( http://wonderfl.net/user/bkzen )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/lbq5
 */

// forked from bkzen's 377 forked from: 397 forked from: Shorten Brainf*ck Interpreter
// forked from Susisu's 397 &lt;- forked from: 405 &lt;- 508 forked from: Shorten Brainf*ck Interpreter
// forked from bkzen's 405 <- 508 forked from: Shorten Brainf*ck Interpreter
// forked from Susisu's Shorten Brainf*ck Interpreter
package{
    import flash.display.Sprite;
    import flash.text.TextField;
    [SWF(width="465", height="465", backgroundColor="0xffffff", frameRate="60")]
    public class BrainfuckInterpreter extends Sprite{
        public function BrainfuckInterpreter(){
            var code:String="++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.";
            var result:TextField=new TextField();
            result.text=b(code);
            addChild(result);
        }
        //Please shorten this!
        // 405 char!
        // 397
        // 377
   }
}
// 283 char
function b(c:*):*{with(c){for(a=[i=p=0],d=charCodeAt,r="",l=length;i<l;i++){a[p]|=0,n=d(i),t=1,n&32&&n&16?p+=(n&3)-1:n&1?a[p]+=(n&3)-2:r+=String.fromCharCode(a[p]);if(n&64&&((n=(n&3)-2)>0?!a[p]:a[p]))for(j=i+n;n>0?j<l:j;j+=n)if(d(j)&64&&!(t+=((d(j)&3)-2)*n)&&(i=j+n))break}return r}}

/*
新しいやりかた思いついた。
function b(c:*):*
{
    with(c)
    {
        for(a=[i=p=0],d=charCodeAt,r="",l=length;i<l;i++)
        {
            a[p]|=0,n=d(i),t=1,n&32&&n&16?p+=(n&3)-1:n&1?a[p]+=(n&3)-2:r+=String.fromCharCode(a[p]);
            if(n&64&&((n=(n&3)-2)>0?!a[p]:a[p]))
                for(j=i+n;n>0?j<l:j;j+=n)
                    if(d(j)&64&&!(t+=((d(j)&3)-2)*n)&&(i=j+n))break
        }
        return r
    }
}
*/