Small snake

HTML

<canvas id=c style=border:solid>

JavaScript

eval('r=Math.random;T=0;k=10;function G(){x=c.getContext("2d"),o=c.width=c.height=500,d=[1,0],s=[[4,4],[5,4],[6,4]],f=[20,15],onkeydown=function(a){w=a.which,t=w%2?[w-38,0]:[0,w-39],d=""+[-d[0],-d[1]]==t?d:t};T=T||setInterval(\'x.clearRect(0,0,o,o),x.fillRect(k*f[0],k*f[1],k,k),_=L;for(i in s)e=s[i],x.fillRect(k*e[0],k*e[1],k,k),i<s.length-1&(""+_==e)?G():0;""+_==f?f=[0|50*r(),0|50*r()]:s.shift(),s.push([L[0]+d[0],L[1]+d[1]]),h=L,h[0]<0|h[1]<0|h[0]>50|h[1]>50?G():0\',55)}G()'.replace(/L/g,"s[s.length-1]"))