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

405 <- 508 forked from: Shorten Brainf*ck Interpreter

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

// 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!
        private function b(c:*):*{var a:*=new Vector.<int>(9),r:*="",p:*,t:*,d:*=c.split(""),l:*=d.length,i:int,j:*,n:*=p=t=j=i,e:*="-+<>.][";for(;i<l;i++){n=1<<e.indexOf(d[i]),a[p]+=(n&3)&&(n|1)-2,p+=(n>>=2)&3&&(n|1)-2,r+=(n>>=2)&1?String.fromCharCode(a[p]):"",t=0;if((n>>=1)&&((n=(n|1)-2)>0?!a[p]:a[p]))for(j=i+n;n>0?j<l:j>=0;j+=n){if(d[j]==(n>0?"[":"]"))t++;if(d[j]==(n>0?"]":"[")&&!t--){i=j;break;}}}return r}
    }
}
        /*
        private function b(c:*):*
        {
            var a:*=new Vector.<int>(9),
            r:*="",p:*,t:*,d:*=c.split(""),
            l:*=d.length,i:int,
            j:*,n:*=p=t=j=i,
            e:*="-+<>.][";
            for(;i<l;i++)
            {
                n=1<<e.indexOf(d[i]),
                a[p]+=(n&3)&&(n|1)-2,
                p+=(n>>=2)&3&&(n|1)-2,
                r+=(n>>=2)&1?String.fromCharCode(a[p]):"",
                t=0;
                if((n>>=1)&&((n=(n|1)-2)>0?!a[p]:a[p]))
                for(j=i+n;n>0?j<l:j>=0;j+=n)
                {
                    if(d[j]==(n>0?"[":"]"))t++;
                    if(d[j]==(n>0?"]":"[")&&!t--)
                    {
                        i=j;break;
                    }
                }
             }
             return r
         }*/