-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult.html
1 lines (1 loc) · 990 Bytes
/
result.html
1
<pre id="e" style="transform:scaleY(.5);text-align:center"><script>var c=14,s=' ',b=0,n="\n",g,u,a=A=[],v,w,q,m=Math,d=m.random,J=clearInterval,K=setInterval,M='innerHTML';r=(n,f)=>{for(j=0;j++<n;f(j));};t=t=>e[M]+=t;z=_=>{e[M]=n;r(c+2,_=>t(b));t(n);for(y=c-1;y>=0;y--){t(b);for(x=0;x<=c-1;x++)B(x,y)||v==x&&w==y||~A.indexOf(y)?t(b):t(s);t(b);t(n);}r(c+2,_=>t(b));};onkeydown=P=>{I=P.keyCode-36;if(m.abs(I-g)!=2)u=I;};F=p=>p==c-1?0:p+1;G=p=>p==0?c-1:p-1;O=_=>{if(u){g=u;u=0;}h=a[0][0];o=a[0][1];if(g==1)h=G(h);if(g==2)o=F(o);if(g==3)h=F(h);if(g==4)o=G(o);if(!B(h,o)){a.unshift([h,o]);a[0][0]==v&&a[0][1]==w?H():a.pop();}else{N(J(q));}};B=(x,y)=>{for(k=0;k<a.length;k++)if(a[k][0]==x&&a[k][1]==y)return 1;};C=_=>~~(d()*(c-1));H=_=>{do{v=C();w=C();}while(B(v,w));};D=_=>{a=[];g=3;r(3,(i)=>(a.push([~~(c/2-i),~~(c/2)])));H();z();};E=_=>{q=K(()=>{O();z();},150);};E(D());N=_=>{l=0;L=1;q=K(()=>{z();if(L){A.push(l);l++;if(l==c)L=0;}else{if(l==c)D();A.pop();l--;if(!l){E(J(q));}}},20);};</script>