Hacker News new | ask | show | jobs
by javajosh 857 days ago
Here is the entire script of the game (I added line breaks, I hope in places that don't break the code):

   X=Y=V=U=Z=t=1;onkeydown=e=>(k=e.which)&1?X-=k-38:Y-=k-39;
   setInterval("for(++t,o=Z,i=50;i--;)for(b.innerText=o+='\\n',j=99;
   j--;Y>49?Z+=Y=1:o+=i-Y|j-X-50?q?'.':'':q?'♥':Y=1)
   q=((j+t*Math.sin(A=i>>1)/9*Z>>3)*A*Z)**4%97<89",9)
The obstacle generation code is very strange and deserves more study. But really remarkable - a tour de force.
1 comments

You can replace the two " with ` so that the code in setInterval is still treated as a string.

Also, see the section:

q?'♥':Y=1

The code is minimized by setting Y back to 1 instead of providing a character to display but this has the visual side effect of "squashing" the player when they are run over.