283 <- 377 forked from: Shorten Brainf*ck Interpreter
forked from 377 forked from: 397 forked from: Shorten Brainf*ck Interpreter (diff: 42)
283 <- 377 forked from: Shorten Brainf*ck Interpreter
ActionScript3 source code
/**
* 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 <- forked from: 405 <- 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
}
}
*/