Small snake
HTML
<canvas id=c style="border:solid">
JavaScript
eval('r=Math.random;T=0;FG(){Fq(a,b){return""+a==b}Fl(a){return a[a.length-1]}x=c.getContext("2d"),o=c.width=c.height=500,d=[1,0],s=[[4,4],[5,4],[6,4]],f=[20,15],onkeydown=F(a){w=a.which,t=w%2?[w-38,0]:[0,w-39],d=q([-d[0],-d[1]],t)?d:t};T=T||setInterval(F(){x.clearRect(0,0,o,o),x.fillRect(10*f[0],10*f[1],10,10),_=l(s);for(i in s)e=s[i],x.fillRect(10*e[0],10*e[1],10,10),i<s.length-1&q(_,e)?G():0;q(_,f)?f=[0|50*r(),0|50*r()]:s.shift(),s.push([l(s)[0]+d[0],l(s)[1]+d[1]]),h=l(s),h[0]<0|h[1]<0|h[0]>50|h[1]>50?G():0},55)}G()'.replace(/F/g,"function "))