11 ms·
And here is a concise JavaScript tetris (playable: http://copy.sh/tetris/ http://copy.sh/tetris/): f=[];p=[1];g=h=2;s=0;t=500;for(i=0;23>i;i++)f[i]=j=-1638
by g3 10y ago
And here is a concise JavaScript tetris (playable: http://copy.sh/tetris/ http://copy.sh/tetris/):
f=[];p=[1];g=h=2;s=0;t=500;for(i=0;23>i;i++)f[i]=j=-16380;f[23]=-1;onkeydown=e;e(e);function e(b,a){(k=b.which)?k-38?k&-3^37||(g+=a=k^37?-1:1):(z=p,v=p[2],c=p[1],p=[2*v&2|4*c&4,p[3]/2&1|v&2|2*c&4|4*p[0]&8,p[3]/4&1|v/2&2|c&4|2*p[0]&8,v/4&2|c/2&4]):s-j&&setTimeout(e,100+t,h++);m=p[0]<<g;l=p[1]<<g;_=p[2]<<g;o=p[3]<<g;f[h+=32==k]&m|f[1+h]&l|f[2+h]&_|f[3+h]&o?a?g-=a:k^38?(f[h]|=l,f[--h]|=m,f[2+h]|=_,f[3+h]|=o,h?(g=6,x=new Date%7*4,p=[h=0,2908739>>x&15,266758006>>x&15],t*=.97):s+=" Game Over!"):p=z:k^32||e(b);for(y=_=o="";24>++y;o+="\n")for(f[y]+4||(f.splice(y,1),f.unshift(j),s+=++_,o="",y=2),x=14;x;q.textContent=o+s)o+=" X"[(f[y]|p[y-h]<<g)>>x--&1]}
- geuis 10y agoJust because you minify and obfuscate this code doesn't somehow make it better or let you win the "contest". I can walk through the submitter's code and understand what's happening clearly. It's fairly well structured and easy enough to read. This is 20x more valuable than any code that is produced using uncommented edge features for a perceived 5% gain. (Note that I'm making up these numbers to illustrate a point.)