function fs(t){c.fillStyle=t}r="red",g="lime",l="blue",k="navy",u=v=9,q=Math.random,z=Math.pow,y=[,r,r,r,0],e=[[,,r,,0],y,y,[,,,,0],[k,l,,l,k],[,l,l,l,0],[,k,,k,0]],ss=[,,k,,k,,,,0],s=[ss,[k,k,k,k,k,k,k,k,k],ss],h=[],w=m=0,c.f=c.fillRect,c.b=c.beginPath,f=function(){m++;for(aa in" ")h.push({x:999,y:999*q()|1,v:5*q()|1});t="px arial",w?(fs(r),c.f(0,0,9999,9999),fs(k),c.font="30"+t,c.fillText("You died. Sorry. space = restart",99,99)):(c.clearRect(0,0,9999,9999),e.forEach(function(t,f){for(j=0;j<t.length;j++)t[j]&&(c.b(),fs(t[j]),c.f(u+9*j,v+9*f,9,9))}),h.forEach(function(t){t.x-=t.v,s.forEach(function(f,e){for(c.b(),fs(k),j=0;j<f.length;j++)f[j]&&c.f(9*t.x+9*j,9*t.y+9*e,9,9)}),(Math.sqrt(z(u/9+2.5-(t.x+3.5),2)+z(v/9+3.5-(t.y+1.5),2))<4.3||u>a.width||u<0||v>a.height||v<0)&&(w=1)}),setTimeout(f,29)),c.font="12"+t,c.fillText("score: "+m,a.width-99,19)},f(),b.onkeydown=function(c){c.preventDefault,t=c.keyCode,38==t&&(v-=9),37==t&&(u-=9),40==t&&(v+=9),39==t&&(u+=9),32==t&&(w=m=0,h=[],u=v=9,f())};
r="red"
g="lime"
l="blue"
k="navy"
u=v=9
q=Math.random
z=Math.pow
y=[,r,r,r,0]
e=[[,,r,,0],y,y,[,,,,0],[k,l,,l,k],[,l,l,l,0],[,k,,k,0]]
ss=[,,k,,k,,,,0]
s=[ss,[k,k,k,k,k,k,k,k,k],ss]
h=[]
w=m=0
c.f=c.fillRect
c.b=c.beginPath
function fs(a){c.fillStyle=a}
f=function(){m++;for(aa in " "){h.push({x:999,y:q()*999|1,v:q()*5|1})}
t="px arial"
if(w){fs(r)
c.f(0,0,9999,9999)
fs(k)
c.font="30"+t
c.fillText("You died. Sorry. space = restart",99,99)
}else{
c.clearRect(0,0,9999,9999);
e.forEach(function(x,i){for(j=0;j<x.length;j++){if(x[j]){c.b();fs(x[j]);c.f(u+j*9,v+i*9,9,9)}}})
h.forEach(function(o){o.x-=o.v
s.forEach(function(x,i){c.b();fs(k)
for(j=0;j<x.length;j++){if(x[j])c.f(o.x*9+j*9,o.y*9+i*9,9,9)
}
})
if(Math.sqrt(z(u/9+2.5-(o.x+3.5),2)+z(v/9+3.5-(o.y+1.5),2))<4.3||u>a.width||u<0||v>a.height||v<0){
w=1
}})
setTimeout(f,29)}c.font="12"+t;c.fillText("score: "+m,a.width-99,19);}
f()
b.onkeydown=function(x){x.preventDefault;t=x.keyCode;if(t==38){v-=9}if(t==37){u-=9}if(t==40){v+=9}if(t==39){u+=9}if(t==32){w=m=0;h=[];u=v=9;f()}}