-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathmin.html
1 lines (1 loc) · 41.7 KB
/
min.html
1
<title>LOSSST</title><meta content="width=device-width,user-scalable=no"name=viewport><script>u=r=d=l=s=c=B=0;trees=[];apples=[];doors=[];cubes=[];hints=[];emoji=[];puzzles=[];TS=function(f){ba[f]&&clearInterval(ba[f]);onkeydown({which:n});ba[f]=setInterval(function(){onkeydown({which:f})},150)};TE=function(f){setTimeout(function(){clearInterval(ba[f]);onkeyup()},150)};var g=0;function ca(){a.style.transform="translateX(-"+q[t]*v+"vh)translateY(-"+w[t]*v+"vh)translateZ(45vh)rotateX(40deg)rotateZ("+g+"rad)"}var x=$=_=0;function da(){var f=0;this.i=function(k){f+=k/48E3*Math.PI*2;return f%=2*Math.PI}}function ea(f){var k=new da,m=new da,n=.1;this.i=function(){if(!f)return 0;var A=f+.4*Math.sin(m.i(3));A=440*Math.pow(2,(A-57)/12);n*=.9998;A=k.i(A);return Math.pow(Math.sin(A),1)*n}}function fa(f){function k(){var k=f.length/2;for(_=$;0>_;)_+=k;_%=k;k=new ea(f[2*_+0].charCodeAt(0)-48);for(var A=new ea(f[2*_+1].charCodeAt(0)-48),P=[],aa=0;48E3>aa;aa++){var ha=k.i(),oa=A.i(),za=.5*ha+oa;P.push(ha+.5*oa);P.push(za)}m(P).play()}function m(f){function k(f){f=m(f);return f[0]+f[1]}function m(f){for(var k=0,m="",n=0;4>n;n++,k+=8)m+=String.fromCharCode(f>>k&255);return m}var n=2*f.length;n="RIFF"+m(n+36)+"WAVEfmt "+m(16)+k(1)+k(2)+m(48E3)+m(192E3)+k(4)+k(16)+"data"+m(n);for(var ha in f)n+=k(32767*f[ha]);return new Audio("data:audio/wav;base64,"+btoa(n))}$=-1;this.forward=function(){$++;k()};this.back=function(){$--;k()}}function ja(f){function k(f){f=m(f);return f[0]+f[1]}function m(f){for(var k=0,m="",n=0;4>n;n++,k+=8)m+=String.fromCharCode(f>>k&255);return m}for(var n=[],A=0;;A++){var P=f(A);if(null===P)break;n.push(P)}f=2*n.length;f="RIFF"+m(f+36)+"WAVEfmt "+m(16)+k(1)+k(1)+m(48E3)+m(96E3)+k(2)+k(16)+"data"+m(f);for(A in n)f+=k(1E4*n[A]);return new Audio("data:audio/wav;base64,"+btoa(f))}function ka(f){return 1E4<f?null:(Math.pow(f,1.055)&128?1:-1)*Math.pow((1E4-f)/1E4,2)/2}function la(f){return 25E3<f?null:((f^f>>3^f*f*7.3^f<<4)&65535)/65536*((25E3-f)/25E3)/2}function ma(f){return 5E3<f?null:(Math.pow(f+1E3*Math.sin(.01*f),.8)&200?.5:-.5)*Math.pow((5E3-f)/5E3,1)/2}function na(f){if(16E3<f)return null;var k=Math.pow((16E3-f)/16E3,2.1)/2;return(f<16E3/7?f+10*Math.sin(-f/900)&16:f&13)?k:-k}function pa(f){return 9E4<f?null:(Math.pow(f+1E3*Math.sin(.01*f),.8)&200?.5:-.5)*Math.pow((9E4-f)/9E4,1)/4}var qa=new fa("nbo0risiubv0uisirbs0ui0i0b0c0f0gniojrlsjuivjymvjubv0ui0i0j0m0n0rsgu0vnxnzgx0vnunsg0n0o0n0g0s0o0nrisjulvgufsjufscrbo0ni0j0b0i0j0il`n0ogqgs`u0vgxgz`0gxl0nsouqvsxuuev0u`0`0eq0slulqcs0qcs0qbs0q`s0njo0reseujv0xeveuj0v0e0q0j0i0g0e0cu0scq00bv0ufr0sgn0vbr0xiz0zjr0sgu0vbx0zgx0vbubsg{0zb{`z^{0zi{fzgv0xiu0vjs0ulr0sbn0oll0nbl0jfi0g00bxc0`zb0^{`0]z^0[z]0Zz[0]z^0`zb0]uf0bxi0f{l0izr0ozn0ixr0nrulrnbo0risiufs0r`o0nb0czf0gzi0gzf0cub0i0j0mvn0m0j0irbscrbs`rbs`sbrbo`q0sgugv`x0zg{gz`s0x`s0v`x0vcx0ues0q`l00eu00`x00ev00`u00eq00`o`"),ra=new fa("p0r0sdk0rco0pdk0p0r0sdw0rcs0pdk0p0r0sdk0rck0pdk0p0r0sdw0rcs0pd0f0g0iwg0bwgx0wgurrnspur0bufwgubs0pkrcsdk0rco0pkk0p0r0sdk0rco0pk0l0k0iwg0b0k0g0n0kzs0nxi0f|l0izr0p0n0lwk0dwg0k0p0k|s0pur0kuo0k0i0l0k0isd0krj0kpd0k0p0rsd0krl0opd0f0g0iskw0riw0pgw0nfw0u`s0rbs0pd0k"),y=localStorage,z=0,C=+y.lossst_s||0,sa=C?ra:qa,D=+y.lossst_m||0,ta=+y.lossst_t||0,ua=+y.lossst_M||0,va=0,ba=[],wa=0,v=5,t=0,q=[],w=[],E=[],F=[],G=y.lossst_S=+y.lossst_S||5,H=0,I=0,J=null,K="0",L=[],M=[],xa=0,N=0,O=0,Q=0,R=0,S=0,T=0,ya=+y.lossst_T||0,Aa=0,U=0,V=0,W="",X=h=0;function Ba(){navigator.userAgent.match(/Mac/)&&(iv.className="a");navigator.userAgent.match(/Fire|Edg/)&&(iv.className+=" c",wa=4E3);D&&(iv.className+=" i");b.className=W;C&&!H&&(ie.innerHTML="");cubes=[];doors=[];trees=[];apples=[];hints=[];emoji=[];if("pz"==W)X=40,h=20,puzzles=[[5,,1,,"0000000000000000000000000",16,9]],G=5,C=0;else if("py"==W)h=X=20,puzzles=[eval("["+location.hash.slice(1).replace(/[01]{2,}/g,'"$&"')+"]")],G=puzzles[0][1],puzzles[0][5]=puzzles[0][6]=8,C=!!puzzles[0][3],hints=[["Move: arrow keys<br>"+(C?"Up/Down: "+(D?"\u2b06\ufe0e/\u2b07\ufe0e":"Shift/Ctrl")+"<br>":"")+"backtrack: "+(D?"\u21a9":"Alt")+"<br>Reset: R",1,5,1,0,C,0]],delete y.lossst_ppy0;else if("px"==W){X=40;h=20;trees=[[15,9,0],[7,13,0],[35,8,0]];apples=[[13,11,0,0,0],[2,12,0,6,0],[38,10,0,7,0]];doors=[[41,10,Math.PI/2,8,0,"pA",1,0,10,0,0],[20,-2,0,14,0,"pD",1,10,19,0,0],[-2,11,-Math.PI/2,6,0,"pJ",1,14,5,1,1],[20,21,Math.PI,14,0,"pC",1,22,1,0,0],[5,21,Math.PI,5,0,"pI",1,36,1,0,1]];puzzles=[];cubes=[];for(f=9;15>f;f++)for(m=0;5>m;m++)2==m&&14==f||2==m&&13==f||3==m&&13==f||3==m&&12==f||2==m&&12==f||cubes.push([m,f]);hints=[["Move with<br>arrow keys"+(D?"":" or WASD/ZQSD"),19,5,0,13,0],["Use the "+(D?"\u21a9":"Alt")+" key to backtrack",1,9,0,13,0,1],["Approach red doors with the right length to open them",35,14,0,13,0],["\u2191<br>New puzzles !<hr>Puzzle editor<br>\u2193",19,8,14,0,0],["\u2190<br>New puzzles !",1,9,6,7,1,1]];emoji=[["\ud83d\udc3f\ufe0f",30,7],["\ud83c\udf30\ufe0f",29,7]]}else if("pA"==W)X=40,h=20,trees=[[35,15,0]],apples=[[33,16,0,0,6],[34,17,0,0,6],[37,15,0,0,6]],cubes=[],doors=[[-2,10,-Math.PI/2,8,0,"px",0,39,11,0,0],[35,21,Math.PI,11,0,"pB",1,35,1,0,0]],puzzles=[[6,,0,,"000000001000001110001110001000000000",2,3],[6,,0,,"000000011000011100010000011000000000",14,3],[6,,0,,"000000000100001100011000011100000000",26,3],[5,,0,,"0000001110011100110000000",2,13],[6,,0,,"000000011000011000001100001100000000",14,13],[6,,0,,"000000000100001100001110001100000000",26,13]],hints=[["Cover the black patterns to solve puzzles",9,9,1,0],["Solve all the puzzles in the room to unlock a new door",21,9,1,0],["Your progress is saved automatically",34,9,1,0]],emoji=[["\ud83d\udc0c",11,10]];else if("pB"==W)D&&(kx.className="",y.lossst_r=1),X=40,h=20,trees=[[4,7,0]],apples=[[1,8,0,0,12],[2,9,0,0,12]],doors=[[35,-2,0,8,0,"pA",0,35,19,0,0],[-2,10,-Math.PI/2,13,0,"pC",1,39,10,0,0]],puzzles=[[6,,0,,"000000011110011010011110000000000000",8,2],[7,,0,,"0000000001110000111000001100000110000010000000000",18,2],[6,,0,,"000000011000011110001010001110000000",28,2],[6,,0,,"000000011100001110001110001100000000",8,12],[6,,0,,"000000001110001110001110001010000000",18,12],[6,,0,,"000000011110011110001100001000000000",28,12]],hints=[["If you get stuck, "+(D?"click \u00d7":"press R")+" to exit a puzzle",35,11,1,0]],cubes=[[11,4],[21,16]],emoji=[["\ud83d\udc08",4,14]];else if("pC"==W)X=40,h=20,trees=[[35,8,0]],apples=[[34,11,0,0,18]],doors=[[41,10,Math.PI/2,8,0,"pB",0,1,10,0,0],[22,-2,0,14,0,"px",1,20,19,0,0]],puzzles=[[7,,0,,"0000000000000001111000111100001111000100000000000",2,3],[7,,0,,"0000000001110000101000011100001110000110000000000",26,3],[6,,0,,"000000001110011110011010001110000000",14,3],[7,,0,,"0000000001100000111000011100001110000110000000000",2,12],[7,,0,,"0000000000000001111100101010011111000000000000000",14,12],[6,,0,,"000000011000011100011110011110000000",26,12]],hints=[["\u2191<br>After this room, you can try a puzzle editor and a new kind of puzzles !",22,11,13,0,0]],cubes=[[29,5],[30,8],[17,6],[15,4],[15,7],[29,13],[30,13],[30,14],[18,15],[16,15],[6,13],[6,17],[7,8],[6,8],[5,8],[3,7],[3,8],[7,6],[7,5]],emoji=[["\ud83e\udd8b<br><br>",29,13]];else if("pD"==W){h=X=20;trees=[[10,2,0]];doors=[[10,21,Math.PI,14,0,"px",0,20,0,0,0],[-2,5,-Math.PI/2,14,0,"pE",0,24,12,0,0]];puzzles=[[7,,1,,"0100010011111000000000000000000000001111100100010",7,7]];hints=[["Now you're thinking with wraps !",2,2,0,14,0]];for(f=0;20>f;f++)cubes.push([f,10]);emoji=[["\ud83d\udc10",12,2]]}else if("pE"==W)h=X=25,trees=[[5,12,0]],apples=[[4,14,0,0,23]],doors=[[26,12,Math.PI/2,14,0,"pD",0,0,5,0,0],[-2,12,-Math.PI/2,15,0,"pF",1,79,5,0,0]],puzzles=[[7,,1,,"1000001000000000000000010100011011011000111000001",3,3],[6,,1,,"110011100001000000100001100001110011",15,17],[5,,1,,"1100111001100011001110011",16,4],[6,,1,,"000011000011110001110001000011000011",3,17]],hints=[["Reminder:<br>use "+(D?"\u21a9":"Alt")+" to backtrack,<br>"+(D?"\u00d7":"R")+" to exit a puzzle.",11,14,1,0,0]],emoji=[["\ud83d\udc12",12,20]];else if("pF"==W)X=80,h=20,trees=[[35,10,0]],apples=[[38,11,0,0,35]],doors=[[81,5,Math.PI/2,15,0,"pE",0,0,12,0,0],[-2,15,-Math.PI/2,16,0,"pG",1,19,5,0,0]],puzzles=[[5,,1,,"0111101001010110100011111",59,13],[5,,1,,"1111011000111100001011110",48,13],[5,,1,,"1111101000011110111001100",37,13],[5,,1,,"1111110000111001000011111",26,13],[5,,1,,"1100101101001110011101101",15,13],[5,,1,,"1111100001110010000111111",59,2],[5,,1,,"1000110111100011000111111",48,2],[5,,1,,"1000110101101011111110001",37,2],[5,,1,,"1111110001000110000111111",26,2],[5,,1,,"0111101100011100011011110",15,2],[5,,1,,"1111101111001110001100001",4,8],[5,,1,,"1010100101111010000111111",71,8]],hints=[["This room hides a surprise !",72,2,0,15,0],["\u2190<br>Exit",38,9,16,0,0]],cubes=[],emoji=[];else if("pG"==W)X=20,h=30,trees=[[5,25,0]],apples=[[4,24,0,0,37],[7,25,0,0,37],[2,26,0,0,37],[3,28,0,0,37]],doors=[[21,5,Math.PI/2,16,0,"pF",0,1,15,0,0],[10,31,Math.PI,20,0,"pH",1,10,1,0,0]],puzzles=[[6,,1,,"001000001110111111011100011000001000",7,6],[6,,1,,"110001100001000111000111100001110001",7,18]],emoji=[["\ud83d\udc01",9,14]];else if("pH"==W)X=20,h=30,trees=[[16,22]],apples=[[18,22,0,0,39]],doors=[[10,-2,0,18,0,"pG",0,10,29,0,0],[21,25,Math.PI/2,21,0,"pI",1,1,10,0,0]],puzzles=[[6,,1,,"001000011110111111011110011110001000",7,6],[6,,1,,"110001100001000011000111001111111111",7,18]],emoji=[["\ud83e\udd86",9,14]];else if("pI"==W){X=40;h=20;apples=[[38,2,0,5,0]];doors=[[-2,10,-Math.PI/2,1,0,"pH",0,19,25,0,0],[36,-2,0,6,0,"px",1,5,19,0,1]];puzzles=[];hints=[["Guess what, you finished the first half of the game !",5,9,1,0],["You can now move up and down with "+(D?"\u2b06\ufe0e and \u2b07\ufe0e":"Shift and Ctrl keys")+", and open black doors",30,11,1,0]];for(f=0;9>f;f++)cubes.push([30,f]);for(f=30;40>f;f++)cubes.push([f,8]);emoji=[["\ud83d\udc22",13,14]];trees=[[3,1],[15,2],[36,3],[26,5],[25,15],[33,9],[10,12],[36,14],[3,15]]}else"pJ"==W?(X=15,h=70,trees=[[2,62]],apples=[[2,65,0,0,47],[1,66,0,0,47]],doors=[[16,5,Math.PI/2,6,0,"px",0,1,11,0,1],[-2,65,-Math.PI/2,8,0,"pK",1,19,65,0,1]],puzzles=[[5,,0,"0000000000000000000001110",,2,2],[4,,0,"0000000001000110",,4,11],[5,,0,"0000000000000000101001110",,6,20],[5,,0,"0000000000000000111000100",,8,29],[4,,0,"0000000001100110","0000011001100000",2,38],[4,,0,"0000010001100100","0000011001100000",4,47],[4,,0,"0000011001000100","0000010001100000",6,56],[4,,0,"0000000001100110","0100011000100000",8,65]],hints=[["You now have to match the patterns on the walls...",10,2,1,0,1],["... and on the floor too !",10,40,1,0,1]],emoji=[["\ud83e\udd89",10,14]]):"pK"==W?(D&&(ky.className=kz.className="",y.lossst_c=1),X=20,h=75,trees=[[2,2]],apples=[[1,4,0,0,59],[2,5,0,0,59],[3,6,0,0,59],[4,2,0,0,59]],doors=[[21,65,Math.PI/2,7,0,"pJ",0,1,65,0,1],[-2,5,-Math.PI/2,12,0,"pL",1,14,5,0,1]],puzzles=[[5,,0,"0000000000010000110001110",,8,69],[6,,0,"000000000000000000000100001110011000",,12,58],[5,,0,"0000000000010000111001000",,2,58],[4,,0,"0000001001100110","0000001001100000",2,45],[5,,0,"0000000000000000010001110","0000000100001100110000000",12,45],[5,,0,"0000000000000000101001110","0000001110010100000000000",2,34],[5,,0,"0000000000000000011001100","0000001110011000010000000",12,34],[4,,1,"0000011001100110","0110000000000110",2,22],[4,,1,"1001000000001001","1001000000001001",12,22],[4,,1,"0000010011110010","0000111101100000",2,12],[4,,1,"0110010000000011","0000011100110000",12,12],[4,,1,"1101000000000001","1101000000010001",12,2]],hints=[["You can rotate the camera with "+(D?"<br>\u21bb and \u21ba":"the keys 1, 2 and 3"),15,68,1,0,1],["Can you guess what's coming next?",7,54,1,0,1],["Yep... 3D puzzles with wrap ! Use "+(D?"\u2b06\ufe0e and \u2b07\ufe0e":"Shift and Ctrl")+" to wrap between top and bottom",7,24,1,0,1]],emoji=[["\ud83d\udc1e",3,70]]):"pL"==W?(X=15,h=80,trees=[[2,70]],apples=[[1,73,0,0,68],[3,75,0,0,68]],doors=[[16,5,Math.PI/2,12,0,"pK",0,1,5,0,1],[-2,75,-Math.PI/2,14,0,"pM",1,14,25,0,1]],puzzles=[[5,,0,"0000000000001001111100100",,2,2],[4,,0,"0000010001100000",,5,11],[5,,0,"0000000110000110111000010",,8,20],[5,,0,"0000000000001000111011111","0000000000111001111100000",2,29],[4,,0,"1000110011101111","0000001111110000",5,38],[4,,0,"0000100011001110","1110110010000000",8,45],[4,,1,"1000100110010001","0000100110010000",2,54],[4,,1,"0000001011110100","0000110011110011",5,63],[5,,1,"0100011000010000111001000","0000001110110000100000000",8,72]],cubes=[[6,12]],emoji=[["\ud83d\udc1d",3,20]]):"pM"==W?(X=15,h=30,trees=[[10,12]],apples=[[8,11,0,0,71],[9,10,0,0,71],[10,9,0,0,71],[11,10,0,0,71],[12,11,0,0,71],[7,12,0,0,71]],doors=[[16,25,Math.PI/2,14,0,"pL",0,1,75,0,1],[-2,5,-Math.PI/2,20,0,"pN",1,14,5,0,1]],puzzles=[[5,,1,"0001100110011001100010000","0001100110011001100010000",2,24],[5,,1,"1100010001000011000111000","0000011000110010000000000",4,13],[5,,1,"1101110001000001000011000","1100010000000001000111011",6,2]],emoji=[["\ud83d\udc13",1,14]]):"pN"==W&&(X=15,h=48,trees=[[10,44]],apples=[[7,45,0,0,75]],doors=[[16,5,Math.PI/2,20,0,"pM",0,1,5,0,1]],puzzles=[[4,,1,"0000111101101111","1000111111111000",5,38],[4,,1,"1111001001001111","1111101010101111",5,28],[4,,1,"1111010101011101","0001101101101111",5,18],[4,,1,"1111000100011110","1111110110011111",5,8]],emoji=[["\ud83d\udc09",13,46]]);a.style.width=X*v+"vh";a.style.height=h*v+"vh";H||(ig.innerHTML="");ih.innerHTML="";for(var f in trees)ig.innerHTML+="<div id=tree"+f+' class="j tr"style=left:'+trees[f][0]*v+"vh;transform:translateX(-7vh)translateY("+(trees[f][1]*v+4)+"vh)rotateX(-70deg)>\ud83c\udf33</div><div id=treeshadow"+f+' class="e h"style=left:'+trees[f][0]*v+"vh;transform:translateX(-7.5vh)translateY("+(trees[f][1]*v+3.5)+"vh)rotateZ(144deg)scaleY(1.5)>\ud83c\udf33";for(f in apples)y["lossst_a"+W+f]?delete apples[f]:ig.innerHTML+="<div id=a"+f+' class="j g '+(y["lossst_A"+W+f]?"":"h")+'"style=left:'+apples[f][0]*v+"vh;transform:translateY("+(apples[f][1]*v+4)+"vh)rotateX(-65deg)>"+("pN"==W?"<div>\u26bd</div>":"<div class=m>\ud83c\udf4e</div>")+"</div><div id=as"+f+' class="e p '+(y["lossst_A"+W+f]?"":"h")+'"style=left:'+apples[f][0]*v+"vh;transform:scaleX(-1)translateY("+(apples[f][1]*v+3)+"vh)rotateZ(212deg)>"+("pN"==W?"\u26bd":"\ud83c\udf4e");for(f in emoji)ig.innerHTML+='<div class="j n"style=left:'+(emoji[f][1]*v-1)+"vh;transform:translateY("+(emoji[f][2]*v+4)+"vh)rotateX(-65deg)><div class=m>"+emoji[f][0];for(f in doors)ig.innerHTML+="<div id=d"+(""+W+f)+' class="do'+(y["lossst_d"+W+f]?" s":"")+'"style=left:'+(doors[f][0]+.5)*v+"vh;top:"+(doors[f][1]+.5)*v+"vh;transform:rotateZ("+doors[f][2]+"rad)translateZ("+doors[f][9]*v+'vh)><div class="y d'+doors[f][10]+'"'+(doors[f][6]?"":"hidden")+">"+doors[f][3]+'</div><div style="position:fixed;width:15vh;height:15vh;background:linear-gradient(transparent,#640 50%);top:-7.4vh;left:-7.5vh">';for(var k in puzzles)for(var m in cubes)y["lossst_p"+W+k]&&cubes[m][0]>=puzzles[k][5]&&cubes[m][0]<puzzles[k][5]+puzzles[k][0]&&cubes[m][1]>=puzzles[k][6]&&cubes[m][1]<puzzles[k][6]+puzzles[k][0]&&delete cubes[m];for(f in cubes)ig.innerHTML+="<div id=cube"+f+' class="z x"style=left:'+cubes[f][0]*v+"vh;top:"+cubes[f][1]*v+'vh;width:5vh;height:5vh><div class=f></div><div class=u style="background-position:'+(-300-cubes[f][0]*v)+"vh "+(-140-cubes[f][1]*v)+'vh"></div><div class=r></div><div class=l></div><div class=b>';for(f in hints)C^hints[f][5]||!(hints[f][3]&&hints[f][3]<=G||hints[f][4]&&hints[f][4]>=G)||(ig.innerHTML+="<div id=h"+(""+W+f)+" class=t style=left:"+hints[f][1]*v+"vh;transform:translateY("+(hints[f][2]*v+5)+"vh)translateZ("+(hints[f][6]*v||0)+"vh)rotateX(-70deg)translateY(-4vh)>"+hints[f][0]);y.lossst_x&&top.hpx0&&(hpx0.style.opacity=1);for(k in puzzles){T=puzzles[k][0];var n="",A="";ih.innerHTML+="<div id=puzzle"+k+' class="z q v '+(puzzles[k][2]&&!y["lossst_p"+W+k]?"w":"")+'"style=left:'+puzzles[k][5]*v+"vh;top:"+puzzles[k][6]*v+"vh;width:"+puzzles[k][0]*v+"vh;height:"+T*v+"vh>"+(puzzles[k][2]?"<div class=l></div><div class=r></div>":"")+"<div id=D"+k+" class=d></div><div id=B"+k+" class=b></div>"+(puzzles[k][2]?"<div class=f>":"");var P="000",aa="fff";y["lossst_p"+W+k]&&(P="44c",aa="fd0",puzzles[k][2]=0);for(f=0;f<T;f++)for(m=0;m<T;m++)puzzles[k][3]&&(n+="<div class=o id=w"+k+f+m+" style=width:"+v+"vh;height:"+v+"vh;background:#"+("1"==puzzles[k][3][f*T+m]?P:aa)+"></div>"),puzzles[k][4]&&(A+="<div class=o id=g"+k+f+m+" style=width:"+v+"vh;height:"+v+"vh;background:#"+("1"==puzzles[k][4][f*T+m]?P:aa)+"></div>");top["D"+k]&&(top["D"+k].innerHTML+=A);top["B"+k]&&(top["B"+k].innerHTML+=n)}"pN"==W&&(ig.innerHTML+="<div style='position:fixed;transform:"+(D?"rotateZ(-90deg)translateX(-87vh)translateY(22vh)translateZ(365vh)":"rotateZ(-90deg)translateX(-83vh)translateY(6vh)translateZ(208vh)")+";font: 30vh/25vh a'>THE<br><br>END");H&&(y.lossst_e||y.lossst_s&&6<y.lossst_S||(ik.style.opacity=im.style.opacity=0,ik.style.position=im.style.position="fixed",ik.style.top=im.style.top="-9vh"),J=0,Y(1),xa=1,Q=O=N=0,puzzles[0][2]=0,setTimeout(function(){(ib.onchange=ib.oninput=resetgrid=function(){Ca();Y();ij.disabled=1;gridval.innerHTML=T=+ib.value;puzzle0.style.width=puzzle0.style.height=T*v+"vh";puzzles[0][0]=T;D0.innerHTML="";A=n=B0.innerHTML="";M=[];L=[];for(f=0;f<T;f++)for(M[f]=[],L[f]=[],m=0;m<T;m++)M[f][m]=0,L[f][m]=0;for(f=0;f<T;f++)for(m=0;m<T;m++)n+="<div class=o id=w"+K+f+m+" style=width:"+v+"vh;padding-top:"+v+"vh></div>",A+="<div class=o id=g"+K+f+m+" style=width:"+v+"vh;padding-top:"+v+"vh></div>";xa&&(D0.innerHTML+=A);N&&(B0.innerHTML+=n)})();iq.onchange=iq.oninput=function(){it.innerHTML=G=+iq.value;Ca();Y()};ik.onclick=function(){ik.checked?xa=1:top.wall&&(xa=0,C=N=1,wall.checked=!0);a.className=N?"haswall":"";resetgrid()};top.wall&&(wall.onclick=function(){wall.checked?(N=1,C=puzzles[0][3]=1):(N=C=0,xa=1,ik.checked=!0,puzzles[0][3]=0);a.className=N?"haswall":"";resetgrid()});top.wrap&&(wrap.onclick=function(){O=puzzles[0][2]=wrap.checked||0;puzzle0.className="z q v "+(O?"w":"");resetgrid()});print=function(k){var n="";for(f=0;f<T;f++)for(m=0;m<T;m++)n=top[k+"0"+f+m].style.background&&top[k+"0"+f+m].style.background.match(/255/)?n+0:n+1;return n};ij.onclick=function(){var f=[];f.push(T);f.push(G);f.push(O?1:0);f.push(N?print("w"):"");f.push(ik.checked?print("g"):"");open("//twitter.com/intent/tweet?text=I%20made%20a%20level%20for%20@MaximeEuziere's%20%23js13k%20game%20LOSSST!%0APlay%20here:%20js13kgames.com%2Fentries%2Flossst%0AMy%20level:%20js13kgames.com%2Fgames%2Flossst%2Findex.html%23"+f+"%0A%23LOSSSTlevels")}},100));"px"!=W||y.lossst_x?(a.style.transition="transform 1s,transform-origin 1s",Ca()):(I=1,setTimeout(function(){Ca();Y();M0.style.transition="transform .5s"},2E3),setTimeout(function(){q.push(q[t]);w.push(w[t]);E.push(0);F.push(F[t]);t++;Y()},5500+wa),setTimeout(function(){M0.style.transition="";R0.style.transition="transform .2s";R0.style.transform="rotateZ("+-Math.PI/4+"rad)"},6500+wa),setTimeout(function(){R0.style.transform="rotateZ("+Math.PI/4+"rad)"},7E3+wa),setTimeout(function(){R0.style.transform=""},7500+wa),setTimeout(function(){S0.style.transition=R0.style.transition=""},8E3+wa),setTimeout(function(){clearInterval(x);z||(I=0);hpx0.style.opacity=1},8400),setTimeout(function(){a.style.transition="transform 1s,transform-origin 1s";y.lossst_x=20;y.lossst_y=10;b.innerHTML+="<div style='position:fixed;font:8vh a;top:3vh;right:3vh'onclick=location='index.html'>\u00d7";D&&(kU.className=kD.className=kL.className=kR.className="",y.lossst_w=1)},9E3));Y()}function Ca(){var f=C&&!H?ia:ie;f.innerHTML="";q=[];w=[];E=[];F=[];t=G-1;if("py"==W)for(i=0;i<G;i++)q[t-i]=1-i,w[t-i]=10,E[t-i]=0,F[t-i]=-Math.PI/2;else if(H)for(i=0;i<G;i++)q[t-i]=13-i,w[t-i]=12,E[t-i]=0,F[t-i]=-Math.PI/2;else if(y.lossst_x){var k=+y.lossst_x,m=+y.lossst_y,n=+y.lossst_z;"px"==W&&2>y.lossst_x&&(n=y.lossst_z=1);if("pI"==W&&z&&1==C)for(i=0;i<G;i++)q[t-i]=20,w[t-i]=10,E[t-i]=-i-1,F[t-i]=0;else if(2>k)for(i=0;i<G;i++)q[t-i]=k-i,w[t-i]=m,E[t-i]=n,F[t-i]=-Math.PI/2;else if(k>X-2)for(i=0;i<G;i++)q[t-i]=k+i,w[t-i]=m,E[t-i]=n,F[t-i]=Math.PI/2;else if(2>m)for(i=0;i<G;i++)q[t-i]=k,w[t-i]=m-i,E[t-i]=n,F[t-i]=0;else if(m>h-2)for(i=0;i<G;i++)q[t-i]=k,w[t-i]=m+i,E[t-i]=n,F[t-i]=0;else for(i=0;i<G;i++)q[t-i]=20,w[t-i]=10,E[t-i]=-i,F[t-i]=0}else if("px"==W)for(i=0;i<G;i++)q[t-i]=20,w[t-i]=10,E[t-i]=-i-1,F[t-i]=0;for(i=0;i<Math.max(G+4,16);i++)f.innerHTML+="<div id=M"+i+" class=sm style=transform:translateX(50vh)translateY(50vh)translateZ(-30vh);width:"+(v-.7)+"vh;height:"+(v-.7)+"vh><div class=ss id=S"+i+"></div><div id=R"+i+' class=sr><div class="z k"id=T'+i+">"+(1>i?"<div style=background:none;box-shadow:none;color:red;font-size:4vh;text-align:center;transform:rotateZ(180deg)translateY(-4vh)translateZ(1.5vh)>Y</div>":"")+'<div class=u style="font:'+.5*v+"vh/"+.8*v+'vh a">'+(1>i?"\ud83d\udc40":"")+"</div><div class=f>"+(1>i?"\u203f":"")+"</div><div class=r></div><div class=l></div><div class=b>"}function Y(f){for(var k={a:0};k.a<G;k={a:k.a,j:k.j,m:k.m,o:k.o},k.a++)if(!f){var m=oldx=oldy=oldz=newx=newy=newz=0;O&&T&&(q[t-k.a-1]==R&&q[t-k.a]==R+T-1?(m=1,oldx=R-1,newx=R+T,oldy=newy=w[t-k.a],oldz=newz=E[t-k.a]):q[t-k.a-1]==R+T-1&&q[t-k.a]==R?(m=1,oldx=R+T,newx=R-1,oldy=newy=w[t-k.a],oldz=newz=E[t-k.a]):w[t-k.a-1]==S&&w[t-k.a]==S+T-1?(m=1,oldy=S-1,newy=S+T,oldx=newx=q[t-k.a],oldz=newz=E[t-k.a]):w[t-k.a-1]==S+T-1&&w[t-k.a]==S?(m=1,oldy=S+T,newy=S-1,oldx=newx=q[t-k.a],oldz=newz=E[t-k.a]):0==E[t-k.a-1]&&E[t-k.a]==T-1?(m=1,oldz=-1,newz=T,oldx=newx=q[t-k.a],oldy=newy=w[t-k.a]):E[t-k.a-1]==T-1&&0==E[t-k.a]&&(m=1,oldz=T,newz=-1,oldx=newx=q[t-k.a],oldy=newy=w[t-k.a]));if(m)top["R"+k.a].style.transform="rotateZ("+F[t-k.a]+"rad)",top["M"+k.a].style.transform="translateX("+(oldx*v+.5)+"vh)translateY("+(oldy*v+.5)+"vh)translateZ("+(oldz*v+.5)+"vh)scale(.01)scaleZ(.01)",setTimeout(function(f){return function(){top["M"+f.a].style.transition="none"}}(k),90),k.j=newx,k.m=newy,k.o=newz,setTimeout(function(f){return function(){top["M"+f.a].style.transform="translateX("+(f.j*v+.5)+"vh)translateY("+(f.m*v+.5)+"vh)translateZ("+(f.o*v+.5)+"vh)scale(.01)"}}(k),100),setTimeout(function(f){return function(){top["M"+f.a].style.transition="";top["M"+f.a].style.transform="translateX("+(q[t-f.a]*v+.25)+"vh)translateY("+w[t-f.a]*v+"vh)translateZ("+(E[t-f.a]*v+.5)+"vh)"}}(k),150);else try{top["M"+k.a].style.transform="translateX("+(q[t-k.a]*v+.25)+"vh)translateY("+w[t-k.a]*v+"vh)translateZ("+(E[t-k.a]*v+.5)+"vh)",top["R"+k.a].style.transform="rotateZ("+F[t-k.a]+"rad)"}catch(A){}try{top["S"+k.a].style.display=0==E[t-k.a]?"":"none"}catch(A){}}H?a.style.transform="translateX(-100vh)translateY(-37vh)translateZ(-5vh)rotateX(33deg)":null===J||y["lossst_p"+W+J]?(a.style.transform="translateX("+-q[t]*v+"vh)translateY("+-w[t]*v+"vh)translateZ(45vh)rotateX(40deg)rotateZ("+g+"rad)",a.style.transformOrigin=""+q[t]*v+"vh "+w[t]*v+"vh"):(a.style.transform="translateX("+(-(R+puzzles[J][0]/2)*v+5)+"vh)translateY("+(-(S+puzzles[J][0]/2)*v+8)+"vh)translateZ("+(90-puzzles[J][0]*(v+3))+"vh)rotateX(30deg)rotateZ("+g+"rad)",a.style.transformOrigin=""+((R+puzzles[J][0]/2)*v+5)+"vh "+((S+puzzles[J][0]/2-1)*v+8)+"vh");k=C?1:0;for(f=0;f<G;f++){if(0>=E[t-f]){k=0;break}for(n in cubes)cubes[n][0]==q[t-f]&&cubes[n][1]==w[t-f]&&1==E[t-f]&&(k=0)}if(k){for(f=0;f<G;f++)E[t-f]--;try{Y()}catch(A){for(var n=2*G;n--;)q.pop(),w.pop(),E.pop(),F.pop(),t--;Aa=0;Y()}}k=q[t];m=w[t];for(f in doors)(doors[f][10]&&C||!doors[f][10]&&!C)&&top["d"+W+f]&&0<doors[f][3]&&G>=doors[f][3]&&4>Math.hypot(k-doors[f][0],m-doors[f][1])&&!y["lossst_d"+W+f]&&(top["d"+W+f].className="do s",!doors[f][6]||"px"==W&&2<f||ja(pa).play(),y["lossst_d"+W+f]=1),top["d"+W+f]&&"do s"==top["d"+W+f].className&&2>Math.hypot(k-doors[f][0],m-doors[f][1])&&(y.lossst_p=W=doors[f][5],setTimeout(Ba,600),y.lossst_x=doors[f][7],y.lossst_y=doors[f][8],y.lossst_z=0);null!==J&&Da();H||(J=null);H||(L=[],M=[]);for(p in puzzles)if(k>=puzzles[p][5]&&k<puzzles[p][5]+puzzles[p][0]&&m>=puzzles[p][6]&&m<puzzles[p][6]+puzzles[p][0]){J=+p;Q=0;y["lossst_p"+W+p]&&(Q=1);K=p;xa=!!puzzles[p][4];N=!!puzzles[p][3];O=!!puzzles[p][2];R=puzzles[p][5];S=puzzles[p][6];T=puzzles[p][0];for(f=0;f<T;f++)for(L[f]=[],M[f]=[],n=0;n<T;n++)puzzles[p][3]&&(M[f][n]=+puzzles[p][3][f*puzzles[p][0]+n]),puzzles[p][4]&&(L[f][n]=+puzzles[p][4][f*puzzles[p][0]+n]);Da()}}function Z(f,k,m){V=0;if(0>f||f>=X||0>k||k>=h)V=1;for(var n in trees)f>=trees[n][0]-1&&f<=trees[n][0]&&k==trees[n][1]&&3>E[t]&&(V=1);for(n in hints)f>=hints[n][1]&&f<=hints[n][1]+3&&k==hints[n][2]&&G>=hints[n][3]&&(!hints[n][4]||G<=hints[n][4])&&(C&&hints[n][5]||!C&&!hints[n][5])&&(V=1);for(n in apples)if(y["lossst_A"+W+n]&&f==apples[n][0]&&k==apples[n][1]&&0==E[t])if(ja(ka).play(),"pN"==W){x=setInterval(sa.forward,150);y.lossst_E=1;setTimeout(function(){I=1;as0.remove();a0.style.transform="translateY(319vh)translateZ(2vh)rotateX(-65deg)rotateY(90deg)";a0.style.transition=a.style.transition="10s";a0.style.transform="translateY(15vh)translateZ(2vh)rotateX(-65deg)";a.style.transform=D?"translateX(-133vh)translateY(-249vh)translateZ(-373vh)rotateZ(90deg)":"translateX(-141vh)translateY(-227vh)translateZ(-185vh)rotateZ(90deg)"},200);var A={},P;for(P in puzzles)A.g=P,setTimeout(function(f){return function(){top["B"+f.g].style.transition=".5s";top["B"+f.g].style.transform="translateY(-125%)"}}(A),[1450,2500,3800,5400][A.g]),A={g:A.g};setTimeout(function(){clearInterval(va);y.lossst_E=1;y.lossst_e=1;b.style.background="#000";y.lossst_s=0;b.innerHTML="<div id=iv style=perspective:90vh><center id=menu style=width:75vh;transform:translateX(-38vh)translateY(-35vh)rotateX(-28deg)><span style=font-size:4vh;line-height:5vh><h1>Congrats!</h1><br>You completed the game in<br>"+ta+" seconds and "+ua+" moves!<br><br><a href=//twitter.com/intent/tweet?text=I%20played%20LOSSST,%20a%20%23js13k%20game%20by%20by%20@MaximeEuziere%0Amy%20score:%20"+ta+"%20seconds%20and%20"+ua+'%20moves!%0Ajs13kgames.com%2Fentries%2Flossst target=_blank style=color:#def;font-size:4vh>TWEET YOUR SCORE</a><br><br>Dev record:<br>742 seconds, 2266 moves<br><br>3D puzzle editor unlocked!<br><br><a href="index.html" style=font-size:4vh>MAIN MENU'},15E3);m=document.querySelectorAll(".o");A={};for(var aa in m){A.h=aa;try{2==m[A.h].style.backgroundColor.match(/68/g).length&&setTimeout(function(f){return function(){top[m[f.h].id].style.background="#a00"}}(A),8E3+10*A.h)}catch(oa){}A={h:A.h}}}else if(delete apples[n],top["a"+n].remove(),top["as"+n].remove(),G++,y.lossst_S=G,y["lossst_a"+W+n]=1,"pF"==W&&16==G){I=1;x=setInterval(sa.forward,150);z=1;a.style.transition="5s";a.style.transform="translateX(-180vh)translateY(-53vh)translateZ("+(D?-422:-180)+"vh)rotateZ(180deg)";setTimeout(function(){a.style.transition="1s";I=z=0;Y();ig.innerHTML+="<div class=t style=left:190vh;transform:translateY(50vh)rotateX(-55deg)translateY(-4vh)>\u2190<br>Exit";clearInterval(x)},1E4);m=document.querySelectorAll(".o");A={};for(var ha in m){A.f=ha;try{m[A.f].id.match(/g\d\d\d$/)&&2==m[A.f].style.backgroundColor.match(/68/g).length&&setTimeout(function(f){return function(){top[m[f.f].id].style.background="#a00"}}(A),5500+10*A.f)}catch(oa){}A={f:A.f}}}for(n in cubes)f==cubes[n][0]&&k==cubes[n][1]&&0==m&&(V=1);for(n in emoji)"pC"!=W&&f==emoji[n][1]&&k==emoji[n][2]&&0==m&&(V=1);for(n in doors)top["d"+W+n]&&"do s"==top["d"+W+n].className&&2>=Math.hypot(f-doors[n][0],k-doors[n][1])&&(V=0);hitcube2=0;for(n=G-2;0<n;n--)q[t-n]==f&&w[t-n]==k&&E[t-n]==m&&(V=1,1==n&&(hitcube2=1));for(p in puzzles)puzzles[p][3]&&f>=puzzles[p][5]&&f<puzzles[p][5]+puzzles[p][0]&&(k==puzzles[p][6]-1&&w[t]==puzzles[p][6]&&!puzzles[p][2]||k==puzzles[p][6]&&w[t]==puzzles[p][6]-1)&&(V=1);if("pI"==W&&18==f&&!C){z=C=V=I=1;clearInterval(x);sa=ra;_=$=0;x=setInterval(ra.forward,250);y.lossst_s=1;y.lossst_S=G=5;for(f=0;21>f;f++)cubes.push([q[t-f],w[t-f]]),top["M"+f].id="",top["R"+f].id="",top["S"+f].id="",top["T"+f].id="";a.style.transition="2s";Ca();Y();a.style.transform="translateX(-105vh)translateY(-51vh)translateZ(80vh)rotateX(45deg)";a.style.transformOrigin="140vh 70vh";setTimeout(function(){q.push(q[t]);w.push(w[t]);E.push(0);F.push(F[t]);t++;Y()},3E3);setTimeout(function(){ii.innerHTML="Daddy!"},4E3);setTimeout(function(){ii.innerHTML=""},6E3);setTimeout(function(){ii.innerHTML="I lossst my soccer ball!"},7E3);setTimeout(function(){ii.innerHTML=""},9E3);setTimeout(function(){ii.innerHTML="But I found new moves!"},1E4);setTimeout(function(){ii.innerHTML="";z=I=0;clearInterval(x);a.style.transition="1s";Y();Ea();D&&(kT.className=kB.className="",y.lossst_B=1)},13500)}}function Da(){if(!Q&&null!==J){solved=1;H&&(ij.disabled=0);for(i=0;i<T;i++)for(j=0;j<T;j++)try{top["g"+K+i+j]&&(top["g"+K+i+j].style.background=L[i][j]?"#000":"#fff"),top["w"+K+i+j]&&(top["w"+K+i+j].style.background=M[i][j]?"#000":"#fff")}catch(n){}if(q[t]<R||q[t]>R+T-1||w[t]<S||w[t]>S+T-1||0>E[t]||E[t]>T-1)H&&(ij.disabled=1);else{for(i=0;i<G;i++){top["g"+K+(w[t-i]-S)+(q[t-i]-R)]&&(top["g"+K+(w[t-i]-S)+(q[t-i]-R)].style.background=L[w[t-i]-S][q[t-i]-R]?"#080":H?"#44c":"#f00");w[t-i]>=S&&w[t-i]<S+T&&top["w"+K+(T-1-E[t-i])+(q[t-i]-R)]&&(top["w"+K+(T-1-E[t-i])+(q[t-i]-R)].style.background=M[T-1-E[t-i]][q[t-i]-R]?"#080":H?"#44c":"#f00");if(q[t-i]<R||q[t-i]>R+T-1||w[t-i]<S||w[t-i]>S+T-1||E[t-i]>T-1)H&&(ij.disabled=1),solved=0;xa&&L[w[t-i]-S]&&!L[w[t-i]-S][q[t-i]-R]&&(solved=0);N&&M[T-1-E[t-i]]&&!M[T-1-E[t-i]][q[t-i]-R]&&(solved=0)}for(i=0;i<T;i++)for(j=0;j<T;j++){try{xa&&3==top["g"+K+i+j].style.backgroundColor.match(/0/g).length&&(solved=0)}catch(n){}try{N&&3==top["w"+K+i+j].style.backgroundColor.match(/0/g).length&&(solved=0)}catch(n){}}if(solved){Q=H?0:1;puzzles[J][2]=0;top["puzzle"+J].classList.remove("w");H||(y["lossst_p"+W+J]=1);for(i=0;i<T;i++)for(j=0;j<T;j++){try{top["g"+K+i+j].style.background=L[i][j]?"#44c":"#fd0"}catch(n){}try{top["w"+K+i+j].style.background=M[i][j]?"#44c":"#fd0"}catch(n){}}H||(ja(na).play(),ya++,y.lossst_T=ya);var f=1,k={},m;for(m in cubes)k.b=m,cubes[k.b][0]>=puzzles[J][5]&&cubes[k.b][0]<puzzles[J][5]+puzzles[J][0]&&cubes[k.b][1]>=puzzles[J][6]&&cubes[k.b][1]<puzzles[J][6]+puzzles[J][0]&&(delete cubes[k.b],f++,setTimeout(function(f){return function(){top["cube"+f.b].remove()}}(k),200*f)),k={b:k.b}}localStorage.v&&delete localStorage.v}}}function Ea(){for(var f in apples)if(!y["lossst_A"+W+f]&&(0<apples[f][3]&&apples[f][3]==G||0<apples[f][4]&&apples[f][4]==ya)){I=1;D&&"px"==W&&1==f&&(kw.className="",y.lossst_b=1);var k=setTimeout;a.style.transform="translateX("+-apples[f][0]*v+"vh)translateY("+-apples[f][1]*v+"vh)translateZ(50vh)rotateX(35deg)";y["lossst_A"+W+f]=1;a.style.transformOrigin=""+apples[f][0]*v+"vh "+apples[f][1]*v+"vh";k(void 0,250);k=setTimeout;top["a"+f].className="j g";top["as"+f].className="e p";k(void 0,800);setTimeout(function(){ja(la).play()},850);setTimeout(function(){Y();z||(I=0)},2E3)}}function Fa(){U=0;H||(J=null);for(p in puzzles)q[t]>=puzzles[p][5]&&q[t]<puzzles[p][5]+puzzles[p][0]&&w[t]>=puzzles[p][6]&&w[t]<puzzles[p][6]+puzzles[p][0]&&0<=E[t]&&E[t]<puzzles[p][0]&&(J=+p,U=1)}onkeydown=function(f){top["lurd************************l**r************l*d***u**u"[f.which-37]]=1;18==f.which&&(B=1);16==f.which&&(s=1);17==f.which&&(c=1);if(!I){if(49==f.which||97==f.which)-1<g&&g--,ca();if(50==f.which||98==f.which)g=0,ca();if(51==f.which||99==f.which)1>g&&g++,ca()}Fa();U?Da():Aa=0;if(82==f.which&&U){if(Aa<=t)for(var k=Aa;k<=t;k++)q.pop(),w.pop(),E.pop(),F.pop(),setTimeout(function(){sa.back()},70*(t-k));t=Aa-1;Aa=0;Y();Da();!H&&y.lossst_Apx0&&(y.lossst_M=++ua)}else if(116!=f.which&&82!=f.which&&17!=f.which&&123!=f.which&&f.preventDefault&&f.preventDefault(),!I){V=0;if(l)!Q&&O&&U&&q[t]==R?(Z(R+T-1,w[t],E[t]),V||(q.push(R+T-1),w.push(w[t]),E.push(E[t]),F.push(Math.PI/2),t++)):(Z(q[t]-1,w[t],E[t]),V||(q.push(q[t]-1),w.push(w[t]),E.push(E[t]),F.push(Math.PI/2),t++));else if(r)!Q&&O&&U&&q[t]==R+T-1?(Z(R,w[t],E[t]),V||(q.push(R),w.push(w[t]),E.push(E[t]),F.push(-Math.PI/2),t++)):(Z(q[t]+1,w[t],E[t]),V||(q.push(q[t]+1),w.push(w[t]),E.push(E[t]),F.push(-Math.PI/2),t++));else if(u)!Q&&O&&U&&w[t]==S?(Z(q[t],S+T-1,E[t]),V||(q.push(q[t]),w.push(S+T-1),E.push(E[t]),F.push(Math.PI),t++)):(Z(q[t],w[t]-1,E[t]),V||(q.push(q[t]),w.push(w[t]-1),E.push(E[t]),F.push(Math.PI),t++));else if(d)!Q&&O&&U&&w[t]==S+T-1?(Z(q[t],S,E[t]),V||(q.push(q[t]),w.push(S),E.push(E[t]),F.push(0),t++)):(Z(q[t],w[t]+1,E[t]),V||(q.push(q[t]),w.push(w[t]+1),E.push(E[t]),F.push(0),t++));else if((C||N)&&s){if(!U){f=G-1;for(k in cubes)cubes[k][0]==q[t]&&cubes[k][1]==w[t]&&f++;if(E[t]==f)return}!Q&&O&&U&&E[t]==T-1?(Z(q[t],w[t],0),V||(q.push(q[t]),w.push(w[t]),E.push(0),F.push(F[t]),t++)):(Z(q[t],w[t],E[t]+1),V||(q.push(q[t]),w.push(w[t]),E.push(E[t]+1),F.push(F[t]),t++))}else(C||N)&&c?!Q&&O&&U&&0==E[t]?(Z(q[t],w[t],T-1),V||(q.push(q[t]),w.push(w[t]),E.push(T-1),F.push(F[t]),t++)):0==E[t]?V=1:(Z(q[t],w[t],E[t]-1),V||(q.push(q[t]),w.push(w[t]),E.push(E[t]-1),F.push(F[t]),t++)):B&&t>G&&(F.pop(),q.pop(),w.pop(),E.pop(),t--);V&&!I&&(I=1,setTimeout(function(){z||(I=0)},150),!(-1<q[t]&&q[t]<X&&-1<w[t]&&w[t]<h)||"pI"==W&&!C&&16<q[t]||hitcube2||ja(ma).play());if(!V&&!z&&(u||r||d||l||s||c||B)){!H&&y.lossst_Apx0&&(y.lossst_M=++ua);Da();Y();B?t>G&&sa.back():(C||!s&&!c&&!C)&&sa.forward();Y(1);Ea();I||(I=1,setTimeout(function(){z||(I=0)},150));if("px"==W&&(C||14<=G)&&20==q[t]&&10==w[t]){I=1;var m=0;for(k=0;k<G;k++)setTimeout(function(){q.push(q[t]);w.push(w[t]);E.push(--m);F.push(F[t]);t++;Y()},150*k);setTimeout(function(){AA("pz",1)},160*G);y.lossst_x=20;y.lossst_y=10}Fa();U&&!Aa&&(Aa=t)}}};onkeyup=function(){u=r=d=l=s=c=B=0};onload=function(){1<location.hash.length?AA("py",1):(setTimeout(function(){x=setInterval(function(){sa.forward()},500)},200),b.innerHTML="<center id=e>\ud83d\udc40</center>\n<center id=iw></center>\n<div id=iv style=perspective:30vh>\n<center id=menu>\n<h1>LOSSST</h1>\n<span onclick=newgame()>New game</span><br>\n"+(y.lossst_a&&!y.lossst_E?"<span onclick=AA(0,1)>Continue</span><br>":"")+"\n<span onclick=AA(\"pz\",1)>Puzzle editor</span><br>\n<span onclick=top.open('//goo.gl/iKqoCS')>Bonus",newgame=function(){for(i in localStorage)0==i.indexOf("lossst")&&"lossst_e"!=i&&delete localStorage[i];y.lossst_a=1;menu.innerHTML="<br><br><span onclick=intro(0)>Desssktop</span><br><br><span onclick=intro(1)>Mobile"},intro=function(f){clearInterval(x);_=$=0;x=setInterval(sa.forward,250);y.lossst_m=D=f;y.lossst_S=G=5;ta=y.lossst_t=0;ua=y.lossst_M=0;y.lossst_M=0;y.lossst_t=0;menu.innerHTML="";setTimeout(function(){e.style.margin=0},500);dir=1;inter=setInterval(function(){e.style.opacity=0;setTimeout(function(){e.style.opacity=1;dir=-dir;e.style.transform="scaleX("+dir+")"},150)},3E3);setTimeout(function(){iw.innerHTML="I lossst my kid !"},2E3);setTimeout(function(){iw.innerHTML=""},5E3);setTimeout(function(){clearInterval(inter);e.style.margin="-80vh 0 0"},7E3);setTimeout(AA,7500)})};AA=function(f,k){if(0===f||"pz"==f)clearInterval(x),_=$=0;"pz"==f&&(H=1,J=0);W=f||y.lossst_p||"px";b.outerHTML="<body id=b class="+W+">\n<div id=iv>\n<div id=a style=transform:translateX(-97vh)translateY(-50vh)rotateZ(90deg)translateZ(119vh);transform-origin:100vh+50vh>\n<div id=ig>"+(H?"<div class=t style=width:60vh;transform:translateX(70vh)translateY(1vh)translateZ(2vh)rotateX(-42deg)>\n<label style=width:100%;text-align:center>Create a pattern with the snake and share it !</label>\n<br style=line-height:6vh>\n<div style=text-align:left;padding-left:5vh>\n<label>Grid</label> <input id=ib type=range value=5 min=3 max=8 step=1>\n<span id=gridval>5</span>\n<br>\n<label>Snake</label> <input id=iq type=range value=5 min=5 max=40 step=1>\n<span id=it>5</span>\n</div>\n<input type=checkbox id=ik checked> <label for=ik id=im>ground</label>\n"+(y.lossst_e||y.lossst_s&&6<y.lossst_S?"<input type=checkbox id=wall> <label for=wall>wall</label>":"")+"\n"+(y.lossst_e||y.lossst_s?"<input type=checkbox id=wrap> <label for=wrap>wrap</label>":"")+"\n<br>\n<center>\n<button id=ij disabled>Share</button>\n</center>\n</div>":"")+"\n</div>\n<div id=ih></div>\n<div id=ie></div>\n<div id=ia></div>\n</div>\n</div>\n<center id=iz style='font:5vh arial,sans-serif;color:#fff;position:fixed;bottom:9vh;left:0;width:100vw'>\n<button id=kU class=h ontouchstart=TS(38) ontouchend=TE(38)>\u2191</button>\n<button id=kD class=h ontouchstart=TS(40) ontouchend=TE(40)>\u2193</button>\n<button id=kL class=h ontouchstart=TS(37) ontouchend=TE(37)>\u2190</button>\n<button id=kR class=h ontouchstart=TS(39) ontouchend=TE(39)>\u2192</button>\n<button id=kT class=h ontouchstart=TS(16) ontouchend=TE(16)>\u2b06\ufe0e</button>\n<button id=kB class=h ontouchstart=TS(17) ontouchend=TE(17)>\u2b07\ufe0e</button>\n<button id=kw class=h ontouchstart=TS(18) ontouchend=TE(18)>\u21a9</button>\n<button id=kx class=h ontouchstart=TS(82) ontouchend=TE(82)>\u00d7</button>\n<button id=ky class=h ontouchstart=TS(49) ontouchend=TE(49)>\u21bb</button>\n<button id=kz class=h ontouchstart=TS(51) ontouchend=TE(51)>\u21ba</button>\n</center>\n<center id=ii style='font:5vh arial,sans-serif;color:#fff;position:fixed;bottom:9vh;left:0;width:100vw'>";y.lossst_Apx0=1;Ba();if(D&&"py"==W||y.lossst_w)kU.className=kD.className=kL.className=kR.className="";if(D&&"py"==W||y.lossst_b)kw.className="";if(D&&"py"==W||y.lossst_r)kr.className="";if(D&&"py"==W||y.lossst_B)kT.className="",kB.className="";if(D&&"py"==W||y.lossst_c)ky.className="",kz.className="";H||(va=setInterval(function(){y.lossst_t=++ta},1E3));k&&(b.innerHTML+="<div style='position:fixed;font:8vh a;top:3vh;right:3vh'onclick=location='index.html'>\u00d7")}</script><style>@keyframes move{0%,100%{transform:rotateY(10deg)}50%{transform:rotateY(-10deg)}}*{margin:0;padding:0;font:2.5vh/5.5vh arial,sans-serif;vertical-align:middle;box-sizing:border-box;-webkit-touch-callout:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;user-select:none;cursor:pointer;touch-action:manipulation}html,body{height:100%;background:#000;overflow:hidden;background:radial-gradient(#def 25%,#7ce)}a{color:#def}input,button{position:relative;z-index:2}input[type=range]::-webkit-slider-runnable-track,input[type=range]::-webkit-slider-thumb{background:#888;border:1px solid #000}input[type=range]::-moz-range-track,input[type=range]::-moz-range-thumb{background:#888;border:1px solid #000}#iv{width:0;height:0;perspective:120vh;position:absolute;top:50%;left:50%}#iv *{transform-style:preserve-3d}#a{width:0;height:0;transform-origin:18vh 0%;transition:transform 1s,transform-origin 1s}.z{position:fixed;top:0;left:0}.z>div{width:100%;height:100%;position:fixed}.z .u{transform:rotateY(90deg)translateX(-100%)rotateY(-90deg)}.z .l{transform:rotateX(-90deg)translateY(-50%)translateX(-50%)rotateY(-90deg)}.z .r{transform:rotateX(-90deg)translateY(-50%)translateX(50%)rotateY(90deg)}.z .f{transform:translateY(50%)rotateX(-90deg)translateY(-50%)}.z .b{transform:translateY(-50%)rotateX(-90deg)translateY(-50%)rotateY(180deg)}.z.q{width:32vh;height:32vh;transform:none}.z.q>div{background:transparent}.z.q .b{transition:opacity .5s;transform:translateY(-50%)rotateX(-90deg)translateY(-52%)}.z.q.w .d,.z.q .d{transition:opacity .5s;background:#0c5b0c}.sm,.sr{transform-origin:50% 50%;width:100%;height:100%;position:fixed}.sm{transition:transform .15s}.z.k{width:100%;height:100%}.z.k>div{box-shadow:0 0 0 .1vh #000 inset;text-align:center}.z.k .f{line-height:3vh}#ie .z.k>div{background:#FFA500}#ie .z.k .u{background:#dF8500}#ia .z.k>div,#a.haswall .z.k>div{background:#444}#ia .z.k .u,#a.haswall .z.k .u{background:#333}#ia .z.k .f{color:#fff}.ss{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.25);transform:translateX(14%)translateY(14%)translateZ(-.25vh)}label{display:inline-block;width:22%}button{display:inline-block;width:23%;border:.2vh solid #000;margin:1vh 2% 0 0}input[type=range]{width:60%}#form{width:50vh;margin:auto}.o{float:left;outline:.4vh solid #888;opacity:0;transition:opacity .5s;background:#fff}.z.q.v{transform:translateZ(.1vh)}.z.q.v .o{opacity:1}.z.q.v .d{transform:none}.z.q.w>div{background:linear-gradient(45deg,rgba(200,200,200,.1),rgba(200,200,200,.3));box-shadow:0 0 .1vh rgba(255,255,255,.5)}.j{position:fixed;transform-origin:50% 100%;bottom:0}.m{animation:move 3s infinite}.e{color:rgba(0,0,0,.002);text-shadow:0px 0px rgba(0,0,0,.25);position:fixed;transform-origin:50% 100%;bottom:0}.tr,.h{font:11vh/12vh a}.a .tr{font:15vh/11vh a}.a .h,.c .h,.i .h,.a .p,.c .p,.i .p,.c .x.b,#iz button.h{display:none}.g,.g *,.p{font:4vh/5vh a;transition:opacity .5s .5s}.n,.n *{font:5vh/6vh a}.g.h,.p.h{opacity:0}.a .g{font:6vh/5vh a}.do{position:fixed;transform-origin:0% 100%;width:0;height:0}.do .y{position:fixed;width:15vh;height:20vh;background:radial-gradient(2vh at 90% 50%,gold 35%,transparent 40%),#a22;border-radius:1vh 1vh 0 0;transform-origin:0% 100%;transform:translateX(-7.5vh)translateY(-12.5vh)rotateX(-90deg);text-align:center;font-size:6vh;line-height:12vh;color:#fff;transition:transform 1s}.do .y.d1{background:radial-gradient(2vh at 90% 50%,gold 35%,transparent 40%),#222}.do.s .y{transform:translateX(-7.5vh)translateY(-12.5vh)rotateX(-90deg)rotateY(90deg)}.z.x div{background:linear-gradient(45deg,#640,#583808)}.z.x div.u{transform:rotateY(90deg)translateX(-5.4vh)translateZ(-.1vh)rotateY(-90deg);background:radial-gradient(#3F7D1F,#034301);background-size:280vh 140vh;width:5.5vh;height:5.5vh}.t{position:fixed;background:#fff;padding:.7vh;width:20vh;font:2vh/2.5vh arial,sans-serif;transform-origin:50% 100%;text-align:center;box-shadow:0 0 0 .2vh #000 inset;bottom:0}.t br{font:0/0 a}.t:before{content:"";width:3vh;height:3vh;background:#750;position:absolute;bottom:-3vh;left:8vh;border-left:.2vh solid;border-right:.2vh solid}.pz .t:before{left:28vh}label{text-align:left}#a{transition:transform 5s ease-in,transform-origin 5s ease-in;width:280vh;height:140vh;background:radial-gradient(#4F8D2F,#136321);border-radius:3vh}.px #a,.pI #a{background:radial-gradient(10vh at 51.3% 52%,#000 40%,transparent 50%),radial-gradient(15vh at 51.3% 52%,#640 40%,transparent 50%),radial-gradient(#4F8D2F,#136321)}#e{margin:99vh 0 0;transition:margin 1s;font:10vh/80vh a}#iw{font:5vh arial,sans-serif;color:#fff;position:fixed;bottom:9vh;left:0;width:100vw}#menu{color:#fff;width:55vh;transform:translateX(-27vh)translateY(-20vh)rotateX(-17deg)}#menu span{font:7vh/12vh arial,sans-serif}#menu h1{font:13vh/16vh arial,sans-serif;text-shadow:.1vh -.1vh #777,.2vh -.2vh #777,.3vh -.3vh #777}#menu span:hover{color:#ace;transform:rotateX(-10deg)}.pN #menu span:hover{color:#fff}#iz button{position:fixed;width:10vh;height:10vh;text-align:center;font:6vh/10vh a}#kU{right:14vh;bottom:14vh}#kD{right:14vh;bottom:2vh}#kL{right:26vh;bottom:2vh}#kR{right:2vh;bottom:2vh}#kT{left:2vh;top:2vh}#kB{left:2vh;top:14vh}#kw{bottom:2vh;left:2vh}#kx{bottom:14vh;left:2vh}#ky{top:2vh;right:18vh}#kz{top:2vh;right:6vh}#hpx0{opacity:0;transition:opacity .5s}</style><body id=b style=background:#000>