Make a circuit by placing corners before the train runs out of track. Click to place tiles, press any key to rotate 90 degrees.
Z=255;e=parseInt;w=window;function q(b,g,m,u,v){g=e(g);m=e(m);L=c.getImageData(g,m,D,D);y=L.data;for(G=z=0;8>z;z++)for(M=0;32>M;M++){r=1<<M;H=b[z]&r?Z:0;I=G%D;J=e(G++/D);for(k=0;k++<u;)f=I,I=D-1-J,J=f;H&&r||(l=I,f=J,A=4*(f*D+l),s=f=0,y[A]=v,y[A+1]=s,y[A+2]=f,y[A+3]=Z)}c.putImageData(L,g,m)}Y=3757801473;n=2147606523;p=[[n,Y,n,Y,n,Y,n,Y],[2684354559,2164203007,2558499071,866095935,667101127,204934919,58790135,3229319169]];n=4027576335;B=40;D=16;E=[];F=N=O=0;W=.5;R=1;P=Q=160;for(i=B;E[--i]=[],i;);
E[10][10]=E[11][10]=2;T=982895205;w.onmousemove=function(b){F=b.clientX;N=b.clientY};w.onkeydown=function(){O=++O%4};w.onmousedown=function(){d=e(W+F/D);h=e(W+N/D);E[d][h]||(E[d][h]=1|2*O)};
function t(){c.clearRect(0,0,a.width,a.height);e(W+F/D);e(W+N/D);for(i=0;i<B;i++)for(j=0;j<B;j++)(X=E[j][i])&&q(p[X&1],j*D,i*D,X>>1);q([n,n,n,n,n,n,n,n],P,Q,R,Z);q(p[1],F,N,O,0);(i=P%D||Q%D)||(j=E[P/D][Q/D],d=T>>4*j&15&~(1<<(R+2)%4),R=Math.log2(d));R||Q--;P+=1==R;Q+=2==R;P-=3==R;(d==1<<R&&j||i)&&setTimeout(t,Q)}t();
Wj0yNTU7ZT1wYXJzZUludDt3PXdpbmRvdztmdW5jdGlvbiBxKGIsZyxtLHUsdil7Zz1lKGcpO209ZShtKTtMPWMuZ2V0SW1hZ2VEYXRhKGcsbSxELEQpO3k9TC5kYXRhO2ZvcihHPXo9MDs4Pno7eisrKWZvcihNPTA7MzI+TTtNKyspe3I9MTw8TTtIPWJbel0mcj9aOjA7ST1HJUQ7Sj1lKEcrKy9EKTtmb3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