import{e as p,f as P,j as n,q as H,J as _,D as g,i as z,aq as O,_ as L,r as U}from"./windi.6302481f.js";import"./config.10ecf26f.js";const N={class:"h-full pt-4 text-center overflow-y-auto",style:{"padding-bottom":"200px"}},V={class:"mt-3"},F={key:0,class:"text-5xl font-bold",style:{"margin-top":"15%"}},B={key:1,class:"text-6xl font-bold"},A={class:"text-4xl font-bold",style:{"margin-top":"35%"}},W={class:"text-left mt-3"},q={class:"flex"},j={class:"flex"};function Y(e,s,i,a,t,l){return p(),P("div",N,[s[7]||(s[7]=n("h1",{class:"text-5xl font-semibold"},"404: Page not found",-1)),n("div",V,[n("div",{class:"relative mx-auto cursor-pointer",style:H({width:a.WIDTH+"px",height:a.HEIGHT+"px"})},[n("canvas",{class:"w-full h-full border border-solid border-black",ref:"game",onClick:s[0]||(s[0]=(...h)=>l.click&&l.click(...h))},null,512),t.overlayed?(p(),P("div",{key:0,class:"absolute top-0 left-0 w-full h-full",style:{background:"rgba(255,255,255,0.8)"},onClick:s[1]||(s[1]=(...h)=>l.startGame&&l.startGame(...h))},[t.message?(p(),P("div",F,_(t.message),1)):g("",!0),t.cheated?(p(),P("div",B,"(you cheated though)")):g("",!0),n("div",A,"Click to play "+_(t.message?"again":""),1)])):g("",!0),n("div",W,[s[6]||(s[6]=n("p",{class:"text-sm"},"Click tiles to spin them. Or tiles next to empty one to move them. Get ooze from start to end tile!",-1)),n("div",q,[s[4]||(s[4]=n("span",{class:"flex-shrink-0 text-left",style:{width:"80px"}},"Size",-1)),z(n("input",{class:"flex-grow",type:"range","onUpdate:modelValue":s[2]||(s[2]=h=>t.size=h),min:"1",max:"5"},null,512),[[O,t.size]])]),n("div",j,[s[5]||(s[5]=n("span",{class:"flex-shrink-0 text-left",style:{width:"80px"}},"Speed",-1)),z(n("input",{class:"flex-grow",type:"range","onUpdate:modelValue":s[3]||(s[3]=h=>t.speed=h),min:"0",max:"10"},null,512),[[O,t.speed]])])])],4)])])}const b=640,k=480,d=1e4,I=1500,x=0,R=1,y=2,v=3,T=4,E=5,S=0,G=1,C=2,D=3,m=0,w=1,u=2,M=3,Z={name:"NotFound",setup(){return{game:U(null),WIDTH:b,HEIGHT:k}},data(){return{oozeMs:0,speed:1,size:2,cheated:!1,overlayed:!0,message:null}},watch:{size:{immediate:!0,handler(e){this.overlayed=!0,this.rows=3*e,this.cols=4*e,this.tw=b/this.cols,this.th=k/this.rows,this.resetGame()}},speed(e){parseInt(e)===0&&!this.overlayed&&(this.cheated=!0)}},mounted(){this.tick=this._tick.bind(this),this.canvas=this.game,this.canvas.width=b,this.canvas.height=k,this.ctx=this.canvas.getContext("2d"),this.renderGame()},unmounted(){this.raf&&cancelAnimationFrame(this.raf)},methods:{resetGame(){this.tiles=[];for(let i=0;id&&!this.oozePath.length)this.oozePath.push([this.sy,this.sx,m]);else if(this.oozePath.length&&Math.floor((this.oozeMs-d)/I)>=this.oozePath.length){const s=this.oozePath[this.oozePath.length-1],[i,a,t]=s;if(this.tiles[i][a].type===y)return this.won();let l=i,h=a,o=t;switch(t){case m:h+=1;break;case w:l+=1;break;case u:h-=1;break;case M:l-=1;break}if(l<0||l>=this.rows||h<0||h>=this.cols)return this.gameOver();const r=this.tiles[l][h];if(r.type===x)return this.gameOver();if(r.type===v){if(r.rot%2!==t%2)return this.gameOver()}else if(r.type===y){if(t!==m)return this.gameOver()}else if(r.type===T)switch(r.rot){case S:if(t===w)o=u;else if(t===m)o=M;else return this.gameOver();break;case G:if(t===w)o=m;else if(t===u)o=M;else return this.gameOver();break;case C:if(t===M)o=m;else if(t===u)o=w;else return this.gameOver();break;case D:if(t===m)o=w;else if(t===M)o=u;else return this.gameOver();break}this.oozePath.push([l,h,o])}this.renderGame(),this.raf=requestAnimationFrame(this.tick)},renderGame(){if(!!this.ctx){this.ctx.clearRect(0,0,b,k),this.ctx.fillStyle="#4e555e",this.ctx.strokeStyle="#4e555e";for(let e=0;e=1&&(h=1),t.beginPath(),t.arc(this.tw*s+this.tw/2,this.th*e+this.th/2,this.th/3*h,0,2*Math.PI),t.fill()}break;case T:{let h=!1,o,r,c,f;switch(l.rot){case S:o=this.tw*s+1,r=this.th*e+1,i===M?(c=Math.PI/2,f=Math.PI/2-Math.PI/2*a,h=!0):(c=0,f=0+Math.PI/2*a);break;case G:o=this.tw*(s+1)-1,r=this.th*e+1,i===m?(c=-Math.PI,f=-Math.PI-Math.PI/2*a,h=!0):(c=-Math.PI*3/2,f=-Math.PI*3/2+Math.PI/2*a);break;case C:o=this.tw*(s+1)-1,r=this.th*(e+1)-1,i===w?(c=-Math.PI/2,f=-Math.PI/2-Math.PI/2*a,h=!0):(c=-Math.PI,f=-Math.PI+Math.PI/2*a);break;case D:o=this.tw*s+1,r=this.th*(e+1)-1,i===u?(c=0,f=-Math.PI/2*a,h=!0):(c=-Math.PI/2,f=-Math.PI/2+Math.PI/2*a);break}t.beginPath(),t.moveTo(o,r),t.arc(o,r,this.th*2/3-1,c,f,h),t.closePath(),t.fill(),t.fillStyle="white",t.beginPath(),t.moveTo(o,r),t.arc(o,r,this.th/3-1,c,f,h),t.closePath(),t.fill(),t.fillStyle="#34d28B";break}case v:case E:switch(i){case 0:t.fillRect(this.tw*s,this.th*e+this.th/3,this.tw*a,this.th/3);break;case 1:t.fillRect(this.tw*s+this.tw/3,this.th*e,this.tw/3,this.th*a);break;case 2:t.fillRect(this.tw*s+this.tw*(1-a),this.th*e+this.th/3,this.tw*a,this.th/3);break;case 3:t.fillRect(this.tw*s+this.tw/3,this.th*e+this.th*(1-a),this.tw/3,this.th*a);break}break}},renderTile(e,s){const{ctx:i}=this,a=this.tiles[e][s];switch(a.type){case x:i.fillStyle="#ccc",i.fillRect(this.tw*s,this.th*e,this.tw,this.th),i.fillStyle="#4e555e";break;case R:i.fillRect(this.tw*s+this.tw/2,this.th*e+this.th/3,this.tw/2,this.th/3),i.beginPath(),i.arc(this.tw*s+this.tw/2,this.th*e+this.th/2,this.th/3,0,2*Math.PI),i.fill();break;case y:i.fillStyle="#34d28B",i.fillRect(this.tw*s,this.th*e,this.tw,this.th),i.fillStyle="#4e555e",i.fillRect(this.tw*s,this.th*e+this.th/3,this.tw/2,this.th/3);break;case v:a.rot%2===0?i.fillRect(this.tw*s,this.th*e+this.th/3,this.tw,this.th/3):i.fillRect(this.tw*s+this.tw/3,this.th*e,this.tw/3,this.th);break;case T:{let t,l,h,o;switch(a.rot){case m:t=this.tw*s,l=this.th*e,h=0,o=Math.PI/2;break;case w:t=this.tw*(s+1),l=this.th*e,h=Math.PI/2,o=Math.PI;break;case u:t=this.tw*(s+1),l=this.th*(e+1),h=Math.PI,o=Math.PI*3/2;break;case M:t=this.tw*s,l=this.th*(e+1),h=Math.PI*3/2,o=0;break}i.beginPath(),i.moveTo(t,l),i.arc(t,l,this.th*2/3,h,o),i.closePath(),i.fill(),i.fillStyle="white",i.beginPath(),i.moveTo(t,l),i.arc(t,l,this.th/3,h,o),i.closePath(),i.fill(),i.fillStyle="#4e555e";break}case E:i.fillRect(this.tw*s,this.th*e+this.th/3,this.tw,this.th/3),i.fillRect(this.tw*s+this.tw/3,this.th*e,this.tw/3,this.th);break}i.strokeRect(this.tw*s,this.th*e,this.tw,this.th)},click(e){const s=this.canvas.getBoundingClientRect(),i=e.clientX-s.left,a=e.clientY-s.top,t=Math.floor(a/this.th),l=Math.floor(i/this.tw),h=this.tiles[t][l];if(h.type<3)return;for(const[c,f]of this.oozePath)if(c===t&&f===l)return;const o=t>=this.emptyy-1&&t<=this.emptyy+1&&l===this.emptyx,r=l>=this.emptyx-1&&l<=this.emptyx+1&&t===this.emptyy;if(o||r){const c=this.tiles[this.emptyy][this.emptyx];c.type=h.type,c.rot=h.rot,h.type=0,this.emptyy=t,this.emptyx=l}else h.rot=(h.rot+1)%4}}},K=L(Z,[["render",Y],["__file","not-found.vue"]]);export{K as default};

AltStyle によって変換されたページ (->オリジナル) /