IMPOSSIBLE ROAD is a pure, minimal arcade game about risk, reward, and rollercoasters.
for(_='*(@c.``fKKc(J16Z/Z0Y,0VV,8U>>9T&&(q=10*L*eightColorinc[Kx(a[i]for(a.width),KillStyle="#fff"dow,`sMath.cos(os,2*tnerWidth/=444s(o ;A=4;--A;)random()@0>qg.addStop(;i;--i;){=function(o){,L*H-L*R-t=_.charCodeAt(s+F&1023)%(12-3*A)@s++>=4*An( - /2- Z0+)i c)i[0]+i[6]]=i];F=Date.now()T="#"+=m(255,Z+(5*i>>A)).toStrg(Z)}g=`cL(C=n=S=f=B=0VU0,a[H=96]1,a[24]onclickf=.25-o.clientX/2},onkeyno=38-o.keyCode,o*o==1&&(f=o/8)},(na.h,*nerH,requestAnimationFrame(nf/=2,n+=f,C+.5C--s=C/(32+37*A-CYYtus%=1,A]=t+(u-t)*s*s*s@s@6*s-15)+10);L/i,R=3*1],o=2]/2-ns=8*L-L*3]*2,t=L/(2+iY,511&C?(J-s,2*u=s/9,s*=4&C?.3:.6,t++):u=CT,s,J-u,-Ju,24==iH+B,R>q&q>R-2&2-3]/2>o*oR,S=CTB=(q>H?1.07@q-H):B)-.07,B=-.5>B?-.5:B>1?1:B)}o=L=0g,S||"IMPOSSIBLE"VV`textAlign="center"cale(8,8H=q,-48>q?"AGAIN?"U):S||"ROAD"Uha=a[96],`arc(Z+6+q/ZVhaBlur=ZVKill()})()';g=/[-T-VYZJK`@]/.exec(_);)with(_.split(g))_=join(shift());eval(_)
Zm9yKF89JyooQGMuYGBmS0tjKEoxNlovWjBZLDBWViw4VT4+OVQmJihxPR8xMCpMKh5laWdodB1Db2xvchxpbhtjWxpLeCgZYVtpXRhmb3IoF2Eud2lkdGgWKSwVS2lsbFN0eWxlPRQVFCIjZmZmIhNkb3cSLGBzEU1hdGguEBBjb3Mobw9zLDIqdBUOG25lcldpZHRoLww9NDQ0CxBzGyhvFQk7F0E9NDstLUE7KQgQcmFuZG9tKClAMD5xFQcVZy5hZGQcU3RvcCgGOxdp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luKHNoaWZ0KCkpO2V2YWwoXyk=
// Compresses down to ~1020b without the debug output
// The "noise" function, "_" is the source code.
// The road is basically an helix with varying radius, angle, and width
// The collision detecion & co can all be done in polar coordinates.
H=96;
z=n=S=f=v=0;
// Offset in the "noise" function to get different roads
F=Date.now()>>9;
// Precalculate the colors
// Setting a #hex fillStyle is much faster than rgb() or hsl()
for(i=444;--i;){
a[i]='#';
for(j=4;--j;) {
a[i]+=Math.min(255,16+(i*5>>j)).toString(16);
}
}
// Gradient for the title/end screen
g=c.createLinearGradient(0,0,0,8);
g.addColorStop(0,a[96]);
g.addColorStop(1,a[24]);
// Controls
onclick=function(x){
f=1/4-x.clientX/innerWidth/2;
};
onkeydown=function(x){
x=38-x.keyCode;
if(x*x==1)f=x/8;
};
// Main
(down=function(x){
a.height=444;
a.width=444*innerWidth/innerHeight;
requestAnimationFrame(down);
f /= 2;
n += f;
// Compute the components of the road
z+=444.5;
for(i=444;--i;){
z--;
for(j=4;--j;) {
s = z / (32+j*37-z/160/160);
t=(_.charCodeAt(s+F&1023)%(12-j*3))*(s++>=j*4);
u=(_.charCodeAt(s+F&1023)%(12-j*3))*(s++>=j*4);
// smoothstep 5th = x*x*x*(x*(x*6-15)+10);
s%=1;
c[j]=t+(u-t)*s*s*s*(s*(s*6-15)+10);
}
// Draw the road slice in 'i'
L=444/i;
R=c[1]*3;
x=c[2]/2-n;
c.setTransform(Math.cos(x),Math.sin(x),-Math.sin(x),Math.cos(x),a.width/2-L*10*Math.sin(x),160+L*10*Math.cos(x));
s=L*8-L*c[3]*2;
t=L/(2+i/160);
// Draw the road slice in 'i'
c.fillStyle = a[i];
if (z&511) {
c.fillRect(-s,L*H-L*R-t,s*2,t*2);
u=s/9;
s*=z&4?.3:.6;
t++;
} else {
u=c.fillText(z>>9,s,L*H-L*R-t);
}
c.fillStyle = '#fff';
c.fillRect(-u,L*H-L*R-t,-s,t*2);
c.fillRect(u,L*H-L*R-t,s,t*2);
// the road slice where the vessel "sits"
if(i==24) {
q = H + v;
// collision detection to stick the vessel to the road
if (q < R & q > (R - 2) & x*x < 2 - c[3]/2) {
q = R;
S = z >> 9;
}
// adjust its velocity
v = (q > H ? (q - H) * 1.07 : v) - .07;
v = v < -.5 ? -.5 : v > 1 ? 1 :v;
}
}
x=L=0;
c.setTransform(Math.cos(x),Math.sin(x),-Math.sin(x),Math.cos(x),a.width/2-L*10*Math.sin(x),160+L*10*Math.cos(x));
// Score
c.fillStyle=g;
c.fillText(S||'IMPOSSIBLE',0,0);
c.textAlign='center';
c.scale(8,8);
H=q;
if(q<-48){
// Game over
c.fillText('AGAIN?',0,8);
} else if (S==0) {
// Game on
c.fillText('ROAD',0,8);
}
// Draw the vessel
c.fillStyle='#fff';
c.shadowColor=a[96];
c.shadowBlur=16;
c.arc(Math.random()*(q<0),16+Math.random()*(q<0),6+q/16,0,16,0);
c.fill();
})()