a="w=body.children.c,E=4099,C=819e=l=n=L=0;R=eK)||[];with(w.getContex'2d')){I(i=[[[76,2G2G6,316@61G4,7@376,24@G153]]][a%7])[(a+c)%i]PclearQw.height7Tm,v(I(l,,14,TI(k,r),x,y'Level(L/10|6'LinesL7'Pointsn8R)A1]+'A0]99+i*9Hhk=l;l=Math.random(r=*E|0;x=6;y=-1M)))y+(i|]|=F;Do8,a=0;o;o]-C?i!o]:ah(i;m =E)L;a>0#(n+00*1<<a||s(Ht+d)))if(F+a&y+c+i]) c#M(r+=d;x+=a;P(y+=c 1va){Da ,o=c-1;i;i%2#fillQo*9,d*9,8,8),o,i>>d}BDR;i#A1]<n;)U1!R ;U1![promp'Name'),n];=JSON.stringify(Rsn#B(L=m=[];n8!C;n;n!E)h(Honkeydown(a=a.keyCode-37)?a-2?0:1:-a-3?0:a=&1HsetInterK'if(e>16-L/1{e=}',4s()}";for(b in c="UR[i+T1v(QRecKval(H)G2Fo <<xDi=AR [@#&&!]=++--0=13,.length7, '+m[0)t(1,document.};(o=I(k,r0,return][,117,2, [i]i in );localStorage['x']fillText(for(],[=function(a,c,d){".split(""))a=a.replace(RegExp(c[b][0],"g"),c[b].slice(1));eval(a)
w=document.body.children.c,
E=4099,
C=8191,
e=l=n=L=0;
R=eval(localStorage['x'])||[];
with(w.getContext('2d')){
// Get block
I=function(a,c,d){return(i=[[[2,7],[2,6,2],[0,7,2],[2,3,2]],[[1,3,2],[6,3]],[[2,3,1],[3,6]],[[2,2,6],[0,7,1],[3,2,2],[4,7]],[[2,2,3],[1,7],[6,2,2],[0,7,4]],[[2,2,2,2],[0,15]],[[3,3]]][a%7])[(a+c)%i.length]};
// Draw
P=function(a,c,d){
clearRect(0,0,1,w.height=171);
v(m,0,0);
v(I(l,0),14,1);
v(I(k,r),x,y);
fillText('Level '+(L/10|0),117,60);
fillText('Lines '+L,117,70);
fillText('Points '+n,117,80);
for(i in R)fillText(R[i][1]+' '+R[i][0],117,99+i*9)
};
// Next block
h=function(a,c,d){
k=l;
l=Math.random(r=0)*E|0;x=6;y=-1
};
// Fix block
M=function(a,c,d){
for(i in (o=I(k,r)))
m[y+(i|0)]|=o[i]<<x;
for(i=o=18,a=0;--o;m[o]-C?m[--i]=m[o]:a++);
for(h();--i;m[i]=E)L++;
a-->0&&(n+=100*1<<a);
t(0,0,0)||s()
};
// Test move
t=function(a,c,d){
for(i in (o=I(k,r+d)))
if(o[i]<<x+a&m[y+c+i++])
return c&&M();
r+=d;
x+=a;
P(y+=c);
return 1
};
// Draw block
v=function(a,c,d){
for(i in a){
for(i=a[i],o=c-1;i;i%2&&fillRect(o*9,d*9,8,8),o++,i>>=1);
d++
}
};
// Update high score
B=function(a,c,d){
for(i=R.length;i--&&R[i][1]<n;)R[i+1]=R[i];R[i+1]=[prompt('Name'),n];
localStorage['x']=JSON.stringify(R);
};
// Start new game
s=function(a,c,d){
n&&B(L=0);
m=[];
for(m[n=18]=C;n;m[--n]=E)h()
};
document.onkeydown=function(a,c,d){
t((a=a.keyCode-37)?a-2?0:1:-1,a-3?0:1,a==1&1)
};
setInterval('if(++e>16-L/10){t(0,1,e=0)}',40);
s()
}