-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.min.html
1 lines (1 loc) · 18 KB
/
index.min.html
1
<!DOCTYPE html><title>glitch maze</title><style>#c{position: absolute; top: calc(50% - 256px); left: calc(50% - 256px); background-color: #222; box-shadow: 0 0 5px #333;}body{background-color: #111;}@media all and (max-width:512px){#c{width: 100vw; height: 100vw; top: calc(50% - 50vw); left: 0;}}@media all and (max-height:512px){#c{width: 100vh; height: 100vh; top: 0; left: calc(50% - 50vh);}}@media all and (max-width:100vh) and (max-height:512px){#c{width: 100vw; height: 100vw; top: calc(50% - 50vw); left: 0;}}@media all and (max-width:512px) and (max-height:100vw){#c{width: 100vh; height: 100vh; top: 0; left: calc(50% - 50vh);}}</style><canvas id=c></canvas><script>"use strict";function genLevel(){game.level=[];var e=0|Math.pow(2,game.levelNum/2+3);e%2===0&&(e+=1);for(var a=0;e>a;++a){game.level.push([]);for(var t=0;e>t;++t)game.level[a].push(WALL)}var n=[[1,1]],r=["1,1"],l=1;game.level[1][1]=EMPTY,temp.stack=n,temp.maxStackLength=1,temp.farthest=[1,1],temp.checked=r,temp.conquered=l,temp.toConquer=(e-1)*(e-1)/4,temp.size=e,temp.levelGenInterval=window.setInterval(function(){for(var e=temp.stack,a=temp.checked,t=temp.conquered,n=!1,r=e[e.length-1],l=0;2e3>l;++l){var m=[checkLevelGenFrom(r,-2,0),checkLevelGenFrom(r,2,0),checkLevelGenFrom(r,0,-2),checkLevelGenFrom(r,0,2)].filter(Boolean);if(m.length>0){var o=m[Math.random()*m.length|0],c=r[0]+o[0],i=r[1]+o[1];game.level[c][i]=EMPTY,game.level[r[0]+o[0]/2][r[1]+o[1]/2]=EMPTY,e.push([c,i]),a.push(c+","+i),e.length>temp.maxStackLength&&(temp.maxStackLength=e.length,temp.farthest=[c,i]),r[0]=c,r[1]=i,++t}else{if(1===e.length){n=!0;break}e.pop(),r=e[e.length-1]}}temp.stack=e,temp.checked=a,temp.conquered=t,displayLevelProgress(t),n&&(window.clearInterval(temp.levelGenInterval),game.level[1][1]=END,onLevelGenDone())},16)}function checkLevelGenFrom(e,a,t){var n=e[0]+a,r=e[1]+t;if(0>n||0>r||n>=temp.size||r>=temp.size)return void 0;var l=n+","+r;return-1===temp.checked.indexOf(l)?[a,t]:void 0}function displayLevelProgress(e){ctx.fillStyle="#111",ctx.fillRect(128,192,256,128),ctx.font="20px monospace",ctx.fillStyle="#eee";var a=e/temp.toConquer,t="level "+game.levelNum+" gen",n=ctx.measureText(t).width;ctx.fillText(t,256-n/2,220),ctx.fillStyle="#2a4",ctx.fillRect(150,240,212*a|0,32),ctx.fillStyle="#eee",ctx.font="25px monospace";var t=(100*a|0)+"%",n=ctx.measureText(t).width;ctx.fillText(t,256-n/2,265),ctx.font="14px monospace";var t=game.levelText[game.levelNum],n=ctx.measureText(t).width;ctx.fillText(t,256-n/2,300)}function onLevelGenDone(){game.player.x=temp.farthest[0],game.player.y=temp.farthest[1],game.player.ox=.5,game.player.oy=.5,game.player.breakpointNum=2*(game.levelNum+1),game.player.breakpoints.length=0,game.levelBeginTime=new Date,anim()}function manageTouch(e){if(!game.fingerDown)return 0;var a=e.touches[0].clientX-game.touchStartX,t=e.touches[0].clientY-game.touchStartY;game.touchStartX=e.touches[0].clientX,game.touchStartY=e.touches[0].clientY,Math.abs(a)>2&&Math.abs(t)>2&&(game.controls.pressed[0]=a>t&&-a>t,game.controls.pressed[1]=t>a&&-a>t,game.controls.pressed[2]=t>a&&t>-a,game.controls.pressed[3]=a>t&&t>-a)}function manageMouse(e){if(!game.fingerDown)return 0;var a=e.clientX-game.touchStartX,t=e.clientY-game.touchStartY;game.touchStartX=e.clientX,game.touchStartY=e.clientY,Math.abs(a)>2&&Math.abs(t)>2&&(game.controls.pressed[0]=a>t&&-a>t,game.controls.pressed[1]=t>a&&-a>t,game.controls.pressed[2]=t>a&&t>-a,game.controls.pressed[3]=a>t&&t>-a)}function anim(){game.state="anim",++game.player.tick,++game.player.ticksSinceLastBreakpoint;var e=!1;ctx.fillStyle="rgba(0,0,0,.2)",ctx.fillRect(0,0,s,s);var a=game.level.length;if(game.levelNum<4?game.screen.x=game.screen.y=a/2:(game.screen.x-=(game.screen.x-game.player.x-game.player.ox)/20,game.screen.y-=(game.screen.y-game.player.y-game.player.oy)/20),game.controls.pressed[4]&&game.player.breakpoints.length<game.player.breakpointNum&&game.player.ticksSinceLastBreakpoint>30&&(game.player.ticksSinceLastBreakpoint=0,game.player.breakpoints.push({x:game.player.x,y:game.player.y})),game.player.ax=(game.controls.pressed[3]-game.controls.pressed[1])*game.player.acc,game.player.ay=(game.controls.pressed[2]-game.controls.pressed[0])*game.player.acc,game.player.vx+=game.player.ax,Math.abs(game.player.vx)>game.player.maxSpeed&&(game.player.vx=game.player.maxSpeed*Math.sign(game.player.vx)),game.player.vy+=game.player.ay,Math.abs(game.player.vy)>game.player.maxSpeed&&(game.player.vy=game.player.maxSpeed*Math.sign(game.player.vx)),game.player.ox+=game.player.vx,game.player.oy+=game.player.vy,game.player.vx*=game.player.mx,game.player.vy*=game.player.my,game.player.ox>1)switch(game.level[game.player.x+1][game.player.y]){case EMPTY:game.player.x+=1,game.player.ox-=1;break;case WALL:game.player.ox=1;break;case END:e=!0}if(game.player.ox<0)switch(game.level[game.player.x-1][game.player.y]){case EMPTY:game.player.x+=-1,game.player.ox-=-1;break;case WALL:game.player.ox=0;break;case END:e=!0}if(game.player.oy>1)switch(game.level[game.player.x][game.player.y+1]){case EMPTY:game.player.y+=1,game.player.oy-=1;break;case WALL:game.player.oy=1;break;case END:e=!0}if(game.player.oy<0)switch(game.level[game.player.x][game.player.y-1]){case EMPTY:game.player.y+=-1,game.player.oy-=-1;break;case WALL:game.player.oy=0;break;case END:e=!0}var t=game.screen.x-16|0,n=game.screen.y-16|0,r=game.screen.x-t-a/2+1,l=game.screen.y-n-a/2+1;game.levelNum>=4&&(r=-game.screen.x+17,l=-game.screen.y+17),game.player.tick<120?ctx.font=game.player.tick/120*16+"px monospace":ctx.font=16*Math.min(.3+.7*((game.player.maxSpeed-(Math.abs(game.player.vx)+Math.abs(game.player.vy)))/game.player.maxSpeed),.75+game.player.tick%60/240)+"px monospace";for(var m=Math.max(t,0);m<Math.min(t+32,a);++m)for(var o=Math.max(n,0);o<Math.min(n+32,a);++o)game.level[m][o]===WALL&&Math.random()<.3&&(ctx.fillStyle="hsla("+(3*(m+o)+game.player.tick)+",80%,50%,1)",ctx.fillText(chars[Math.random()*chars.length|0],16*(r+m),16*(l+o)));ctx.fillStyle="#ccc",ctx.fillText(chars[Math.random()*chars.length|0],16*(r+1),16*(l+1)),ctx.font="8px monospace",ctx.fillStyle="#fff",ctx.fillText(chars[Math.random()*chars.length|0],16*(r-.5+game.player.x+game.player.ox),16*(l-.5+game.player.y+game.player.oy)),ctx.fillStyle="#888";for(var c=0;c<game.player.breakpoints.length;++c)ctx.fillText(chars[Math.random()*chars.length|0],16*(r+game.player.breakpoints[c].x),16*(l+game.player.breakpoints[c].y));game.controls.pressed[5]?(e=!0,openMenu(!1)):e?openMenu(!0):window.requestAnimationFrame(anim),ctx.fillStyle="#aaa",ctx.font="16px monospace";var i="breakpoints: "+(game.player.breakpointNum-game.player.breakpoints.length)+";";ctx.fillText(i,20+2*Math.random(),490+2*Math.random());var g=new Date(new Date-game.levelBeginTime),p=""+g.getMinutes(),h=""+g.getSeconds();1===p.length&&(p="0"+p),1===h.length&&(h="0"+h);var i="time: "+p+"."+h+";";ctx.fillText(i,20+2*Math.random(),470+2*Math.random())}function openMenu(e){game.state="menu",++game.ticksSinceMenuInteraction,++game.menuTick;var a=!1;e&&(++game.levelNum,game.levelNum>game.highestLevel&&(game.highestLevel=game.levelNum,localStorage.levelNum=game.levelNum)),ctx.fillStyle="rgba(0,0,0,.1)",ctx.fillRect(0,0,s,s),ctx.font="16px monospace";for(var t=256-16*game.glitchSchema[0].length/2,n=100,r=0;r<game.glitchSchema.length;++r)for(var l=0;l<game.glitchSchema[0].length;++l)" "!==game.glitchSchema[r][l]&&Math.random()<.4&&(ctx.fillStyle="x"===game.glitchSchema[r][l]?"#eee":"hsl("+(4*(l+r)+game.menuTick)+",80%,50%)",ctx.fillText(chars[Math.random()*chars.length|0],t+16*l,n+16*r));if(game.ticksSinceMenuInteraction>10){var m=!0;game.controls.pressed[1]&&game.levelNum>0?--game.levelNum:game.controls.pressed[3]&&game.levelNum<game.highestLevel?++game.levelNum:game.controls.pressed[0]||game.controls.pressed[2]||game.controls.pressed[4]||game.controls.pressed[5]?(a=!0,genLevel()):m=!1,m&&(game.ticksSinceMenuInteraction=0)}var o=2*Math.random(),c=2*Math.random();ctx.fillStyle="#eee",ctx.font="60px monospace";var i=ctx.measureText(game.levelNum).width;ctx.fillText(game.levelNum,256-i/2+o,265+c),ctx.font="20px monospace";var i=ctx.measureText(game.levelText[game.levelNum]).width;ctx.fillText(game.levelText[game.levelNum],256-i/2+o,320+c),ctx.fillStyle="#888",ctx.font="16px monospace",ctx.fillText("@MateiCopot",235+2*Math.random(),410+2*Math.random()),ctx.fillText("/towc.eu",235+2*Math.random(),440+2*Math.random()),ctx.fillText("[email protected]",235+2*Math.random(),380+2*Math.random()),ctx.fillStyle=game.levelNum>0?"#aaa":"#333",ctx.beginPath(),ctx.moveTo(100,243),ctx.lineTo(120,223),ctx.lineTo(120,263),ctx.fill(),ctx.fillStyle=game.levelNum<game.highestLevel?"#aaa":"#333",ctx.beginPath(),ctx.moveTo(412,243),ctx.lineTo(392,223),ctx.lineTo(392,263),ctx.fill(),ctx.fillStyle="#89e",ctx.fillText("t",180+2*Math.random(),410+2*Math.random()),ctx.fillStyle="#45a",ctx.fillText("f",180+2*Math.random(),440+2*Math.random()),ctx.fillStyle="#a45",ctx.fillText("m",180+2*Math.random(),380+2*Math.random()),a||window.requestAnimationFrame(function(){openMenu()})}var CPlayer=function(){var e,a,t,n,r,l=function(e){return Math.sin(6.283184*e)},m=function(e){return 2*(e%1)-1},o=function(e){return.5>e%1?1:-1},c=function(e){var a=e%1*4;return 2>a?a-1:3-a},i=function(e){return.003959503758*Math.pow(2,(e-128)/12)},g=function(e,a,t){var n,r,l,m,o,c,g,p=s[e.i[0]],h=e.i[1],f=e.i[3],y=s[e.i[4]],x=e.i[5],v=e.i[8],d=e.i[9],u=e.i[10]*e.i[10]*4,w=e.i[11]*e.i[11]*4,M=e.i[12]*e.i[12]*4,k=1/M,S=e.i[13],L=t*Math.pow(2,2-e.i[14]),T=new Int32Array(u+w+M),b=0,N=0;for(n=0,r=0;u+w+M>n;n++,r++)r>=0&&(S=S>>8|(255&S)<<4,r-=L,c=i(a+(15&S)+e.i[2]-128),g=i(a+(15&S)+e.i[6]-128)*(1+8e-4*e.i[7])),l=1,u>n?l=n/u:n>=u+w&&(l-=(n-u-w)*k),m=c,f&&(m*=l*l),b+=m,o=p(b)*h,m=g,v&&(m*=l*l),N+=m,o+=y(N)*x,d&&(o+=(2*Math.random()-1)*d),T[n]=80*o*l|0;return T},s=[l,o,m,c];this.init=function(l){e=l,a=l.endPattern-2,t=0,n=l.rowLen*l.patternLen*(a+1)*2,r=new Int32Array(n)},this.generate=function(){var m,o,c,i,p,h,f,y,x,v,d,u,w,M,k=new Int32Array(n),S=e.songData[t],L=e.rowLen,T=e.patternLen,b=0,N=0,E=!1,D=[];for(c=0;a>=c;++c)for(f=S.p[c],i=0;T>i;++i){var Y=f?S.c[f-1].f[i]:0;Y&&(S.i[Y-1]=S.c[f-1].f[i+T]||0,15>Y&&(D=[]));var C=s[S.i[15]],P=S.i[16]/512,A=Math.pow(2,S.i[17]-9)/L,W=S.i[18],I=S.i[19],X=43.23529*S.i[20]*3.141592/44100,B=1-S.i[21]/255,G=1e-5*S.i[22],R=S.i[23]/32,q=S.i[24]/512,F=6.283184*Math.pow(2,S.i[25]-9)/L,O=S.i[26]/255,z=S.i[27]*L;for(d=(c*T+i)*L,p=0;4>p;++p)if(h=f?S.c[f-1].n[i+p*T]:0){D[h]||(D[h]=g(S,h,L));var U=D[h];for(o=0,m=2*d;o<U.length;o++,m+=2)k[m]+=U[o]}for(o=0;L>o;o++)y=2*(d+o),v=k[y],v||E?(u=X,W&&(u*=C(A*y)*P+.5),u=1.5*Math.sin(u),b+=u*N,w=B*(v-N)-b,N+=u*w,v=3==I?N:1==I?w:b,G&&(v*=G,v=1>v?v>-1?l(.25*v):-1:1,v/=G),v*=R,E=v*v>1e-5,x=Math.sin(F*y)*q+.5,M=v*(1-x),v*=x):M=0,y>=z&&(M+=k[y-z+1]*O,v+=k[y-z]*O),k[y]=0|M,k[y+1]=0|v,r[y]+=0|M,r[y+1]+=0|v}return t++,t/8},this.createWave=function(){var e=2*n-8,a=e-36,t=44,l=new Uint8Array(t+2*n);l.set([82,73,70,70,255&e,e>>8&255,e>>16&255,e>>24&255,87,65,86,69,102,109,116,32,16,0,0,0,1,0,2,0,68,172,0,0,16,177,2,0,4,0,16,0,100,97,116,97,255&a,a>>8&255,a>>16&255,a>>24&255]);for(var m=0,o=t;n>m;++m){var c=r[m];c=-32767>c?-32767:c>32767?32767:c,l[o++]=255&c,l[o++]=c>>8&255}return l},this.getData=function(e,a){for(var t=2*Math.floor(44100*e),n=new Array(a),l=0;2*a>l;l+=1){var m=t+l;n[l]=e>0&&m<r.length?r[m]/32768:0}return n}},song={songData:[{i:[2,100,128,0,3,201,128,0,0,0,0,6,29,0,0,0,194,4,1,3,25,191,115,244,147,6,84,6],p:[5,1,2,1,1,1,1,3,4,1,2,1,2,1,2,,,7,8,7,8,7,8,7,8,6,9],c:[{n:[123,123,135,128,123,123,135,130,126,125,126,128,123,123,135,128,123,123,135,130,126,125,126,128,123,123,135,128,123,123,135,130],f:[21,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,48]},{n:[123,123,135,128,123,123,135,130,126,125,126,128,123,123,135,128,123,123,135,130,126,125,126,128,123,,99,,,,99,,,,,,,,,,,,,,,,,,,,,,,,,,111],f:[,,,,,,,,,,,,,,,,,,,,,,,,,,,11,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,31]},{n:[111,,,,,,,,123,,,,,,,,111,,,,,,,,123],f:[]},{n:[114,,,,,,,,126,,,,,,,,114,,,,,,,,114,126,111,123,114,126,118,130],f:[13,,,,,,,,,,,,,,,,,,,,,,,,13,,13,,13,,13,11,29,,,,,,,,,,,,,,,,,,,,,,,,32,,41,,29,,25,15]},{n:[123,123,135,128,123,123,135,130,126,125,126,128,123,123,135,128,123,123,135,130,126,125,126,128,123,,99,,,,99,,,,,,,,,,,,,,,,,,,,,,,,,,111],f:[13,11,21,17,,,,,,,,,,,,,,,,,,,,,,,,,,,,17,29,,25,113,,,,,,,,,,,,,,,,,,,,,,,,,,,,194]},{n:[111,,,,,,,,123,,,,,,,,111,,,,,,,,99],f:[]},{n:[111,123,,123,111,,123,111,111,123,,123,111,,123,111,111,123,,123,111,,123,111,111,123,,123,111,,123,111],f:[]},{n:[114,126,,126,114,,126,114,114,126,,126,114,,126,114,114,126,,126,114,,126,114,116,128,,128,116,,114,121],f:[]},{n:[],f:[]}]},{i:[0,255,117,1,0,255,110,0,1,0,4,6,35,0,0,0,0,0,0,2,14,1,1,39,76,5,0,0],p:[,1,1,1,1,1,1,2,,,,1,1,1,1,1,1,,,1,1,1,1,1,1],c:[{n:[147,,,,,,147,,,,147,,,,,,147,,,,,,147,,,,147,,,,147],f:[]},{n:[147],f:[]}]},{i:[0,0,140,0,0,0,140,0,0,60,4,10,68,0,0,0,187,5,0,1,239,135,0,32,108,5,16,4],p:[,1,1,2,3,2,3,4,,,,2,3,2,3,2,3,,,5,5,5,5,5,5,4],c:[{n:[,,,,147,,,,,,,,148,,,,,,,,147,,,,,,,,147],f:[13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35]},{n:[,,,,147,,,147,,,,,148,,,,,,,,147,,,147,,,147,,,,147],f:[13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35]},{n:[,,,,147,,,147,,,,,148,,,,,,,,147,,,147,,,147,,,147,147,147],f:[13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35]},{n:[147],f:[13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,68]},{n:[147,,,147,,,147,,147,,,147,,147,,147,147,,,147,,,147,,147,,,147,,147,,147],f:[13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35]}]},{i:[2,192,128,0,2,192,140,18,0,0,107,115,138,0,0,0,136,5,1,2,8,92,21,56,148,5,85,8],p:[3,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2],c:[{n:[111],f:[]},{n:[114],f:[]},{n:[111],f:[24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,24,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,56]}]},{i:[3,0,127,0,3,68,127,0,1,218,4,4,40,0,0,1,55,4,1,2,67,115,124,190,67,6,39,1],p:[,,,1,2,1,2,3,,,,1,2,1,2,1,2,,,1,4,1,4,1,4,3],c:[{n:[,,,,147,,,,,,,,147,,,,,,,,147,,,,,,,,147],f:[]},{n:[,,,,147,,,,,,,,147,,,,,,,,147,,,,,,,,147,,147,147],f:[]},{n:[147],f:[]},{n:[,,,,147,,,,,,,,147,,,,,,,,147,,,,,,,,147,,,147],f:[]}]},{i:[0,91,128,0,0,95,128,12,0,0,12,0,67,0,0,0,0,0,0,2,255,15,0,32,83,3,134,4],p:[,,,1,2,3,2,1,2,,,1,2,3,2,1,2,,,,,4,5,4,5],c:[{n:[159,,147,,154,,147,,157,,147,,154,,150,,159,,147,,154,,147,,162,,147,,154,,150,,123],f:[5,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,67]},{n:[159,,147,,154,,147,,157,,147,,154,,150,,159,,147,,154,,147,,162,,147,,157,,162,,126],f:[]},{n:[159,,147,,154,,147,,157,,147,,154,,150,,159,,147,,154,,147,,162,,147,,154,,150,,123],f:[5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3]},{n:[159,,162,,164,,,,159,,162,164,,,162,,159,,162,,164,,,,159,,162,164,,,162],f:[13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,25]},{n:[157,,162,,164,,,,157,,162,164,,,162,,157,,162,,164,,,,157,,162,164,,,162],f:[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,67]}]},{i:[3,146,140,0,1,224,128,3,0,0,92,0,95,0,0,3,179,5,1,3,37,135,63,67,150,3,157,6],p:[,,,,,,,,,1,2,3,,1,2,1,2,3,,4,5,,,,,3],c:[{n:[123,,,,,,,,,,,,,,,,130],f:[11,24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,92,67]},{n:[133,,,,,,,,,,,,,,,138,126,,,,,,,,,,,,125],f:[11,,,,,,,,,,,,,,,,,,,,,,,,,,,,11,,,,95,,,,,,,,,,,,,,,,,,,,,,,,,,,,29]},{n:[123],f:[24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,24,52,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,67]},{n:[123,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,138,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,116],f:[11,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,95]},{n:[133,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,126,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,118],f:[]}]},{i:[0,255,106,1,0,255,106,0,1,0,5,7,164,0,0,0,0,0,0,2,255,0,2,16,83,5,53,1],p:[,,,,,,,1,,,,,,,,,,1,,,,,,,,1],c:[{n:[147],f:[]}]}],rowLen:5513,patternLen:32,endPattern:28},s=c.width=c.height=512,ctx=c.getContext("2d"),EMPTY=0,WALL=1,END=2,chars='1234567890=qwertyuiop[]asdfghjkl;\'#zxcvbnm,./`¬!"£$%^&*()_+QWERTYUIOP{}ASDFGHJKL:@~|ZXCVBNM<>?"',game={},temp={};game.levelNum=game.highestLevel=+localStorage.levelNum||0,game.level=[],game.levelText=["wasd hjkl ←↑↓→","reach top left","tap space for breakpoints","P or M for menu","always at farthest point","faster → smaller chars","size is 2^(level/2+3)+1","lots of time to waste?","you're mental","don't you have a life?"],game.touchStartX=window.innerWidth/2,game.touchStartY=window.innerHeight/2,window.addEventListener("touchstart",function(){game.fingerDown=!0}),window.addEventListener("touchstart",manageTouch),window.addEventListener("touchmove",manageTouch),window.addEventListener("touchend",function(){game.fingerDown=!1,game.touchStartX=window.innerWidth/2,game.touchStartY=window.innerHeight/2;for(var e=0;e<game.controls.pressed.length;++e)game.controls.pressed[e]=!1}),window.addEventListener("mousedown",function(){game.fingerDown=!0}),window.addEventListener("mousedown",manageMouse),window.addEventListener("mousemove",manageMouse),window.addEventListener("mouseup",function(){game.fingerDown=!1,game.touchStartX=window.innerWidth/2,game.touchStartY=window.innerHeight/2;for(var e=0;e<game.controls.pressed.length;++e)game.controls.pressed[e]=!1}),game.player={x:1,y:1,ox:.5,oy:.5,vx:0,vy:0,ax:0,ay:0,mx:.6,my:.6,acc:.1,maxSpeed:.4,tick:0,breakpoints:[],ticksSinceLastBreakpoint:0,ticksSinceLastMenuAction:0,menuOpen:!0},game.screen={x:1.5,y:1.5},game.controls={pressed:[!1,!1,!1,!1,!1,!1],keyCodes:[[75,38,87],[72,37,65],[74,40,83],[76,39,68],[32,13],[80,77]]},window.addEventListener("keydown",function(e){for(var a=0;a<game.controls.keyCodes.length;++a)game.controls.keyCodes[a].indexOf(e.keyCode)>-1&&(game.controls.pressed[a]=!0)}),window.addEventListener("keyup",function(e){for(var a=0;a<game.controls.keyCodes.length;++a)game.controls.keyCodes[a].indexOf(e.keyCode)>-1&&(game.controls.pressed[a]=!1)}),game.glitchSchema=["111 1 x 1 1 ","1 1 111 11 111","1 1 1 1 1 1 1 1","111 1 1 11 11 1 1"],game.menuTick=0,game.state="menu",game.ticksSinceMenuInteraction=0,openMenu();var t0=new Date,player=new CPlayer;player.init(song),player.generate();var wave=player.createWave(),audio=document.createElement("audio");audio.src=URL.createObjectURL(new Blob([wave],{type:"audio/wav"})),audio.play(),audio.loop=!0;var favicon=document.createElement("canvas");favicon.width=favicon.height=16;for(var favCtx=favicon.getContext("2d"),x=0;16>x;++x)for(var y=0;16>y;++y)Math.random()<.5&&(favCtx.fillStyle="hsl("+360*(x+y)/16+",60%,50%)",favCtx.fillRect(x,y,1,1));var link=document.createElement("link");link.type="image/x-icon",link.rel="shortcut icon",link.href=favicon.toDataURL("image/x-icon"),document.getElementsByTagName("head")[0].appendChild(link);</script>