diff options
Diffstat (limited to 'minesweeper')
-rw-r--r-- | minesweeper/ding.ogg | bin | 0 -> 7002 bytes | |||
-rw-r--r-- | minesweeper/explode.ogg | bin | 0 -> 17296 bytes | |||
-rw-r--r-- | minesweeper/index.html | 211 | ||||
-rw-r--r-- | minesweeper/minesweeper.js | 428 |
4 files changed, 639 insertions, 0 deletions
diff --git a/minesweeper/ding.ogg b/minesweeper/ding.ogg Binary files differnew file mode 100644 index 0000000..24701f1 --- /dev/null +++ b/minesweeper/ding.ogg diff --git a/minesweeper/explode.ogg b/minesweeper/explode.ogg Binary files differnew file mode 100644 index 0000000..0a10885 --- /dev/null +++ b/minesweeper/explode.ogg diff --git a/minesweeper/index.html b/minesweeper/index.html new file mode 100644 index 0000000..fc18254 --- /dev/null +++ b/minesweeper/index.html @@ -0,0 +1,211 @@ +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<meta name="viewport" content="width=device-width"> +<title>Chrisoft::Minesweeper</title> +<link rel="icon" href="../favicon.png"> +<link rel="stylesheet" type="text/css" href="../common.css"> +<link rel="stylesheet" type="text/css" href="../panel.css"> +<link rel="stylesheet" type="text/css" href="/theme0a.css" id="theme0a"> +<link rel="stylesheet" type="text/css" href="/theme0b.css" id="theme0b"> +<link rel="stylesheet" type="text/css" href="/theme1a.css" id="theme1a"> +<link rel="stylesheet" type="text/css" href="/theme1b.css" id="theme1b"> +<link rel="stylesheet" type="text/css" href="/theme2a.css" id="theme2a"> +<link rel="stylesheet" type="text/css" href="/theme2b.css" id="theme2b"> +<link rel="stylesheet" type="text/css" href="/theme3a.css" id="theme3a"> +<link rel="stylesheet" type="text/css" href="/theme3b.css" id="theme3b"> +<script type="text/javascript" src="../panel.js"></script> +<script type="text/javascript" src="minesweeper.js"></script> +<style> +div#OptionsContainer +{ + text-align:center; + margin:auto; +} +select +{ + background-color:#CCC; + border:1px #999 solid; + padding:0.5em 0.2em; +} +button +{ + border:none; + color:white; + padding:0.5em 2em; + text-align:center; + background-color:#4A4; + transition-duration: 0.2s; +} +button:hover +{ + background-color:#6C6; +} +button.off +{ + background-color:#A44; +} +button.off:hover +{ + background-color:#C66; +} +button.disabled:hover, button.disabled +{ + background-color:#888; +} +div#containerDiv +{ + margin:auto; + position:relative; +} +div.clickable +{ + position:absolute; + text-align:center; + border:1px black solid; +} +div.overlay +{ + pointer-events:none; + display:table; + position:absolute; + text-align:center; +} +div.trans +{ + transition:100ms; +} +div.modal +{ + background-color:rgba(0,0,0,0.6); + color:#FFF; + width:60%; + min-height:40%; + position:absolute; + left:50%; + top:50%; + transform:translate(-50%,-50%); + transition:100ms; + font-size:1.4em; + padding:1em; +} +@media(max-width:768px) +{ + div.modal{width:90%;min-height:60%;font-size:1.2em;} +} +@media all +{ + #panel{left:-15em;} +} +div{ + -webkit-user-select:none !important; + -webkit-touch-callout:none !important; +} +div#progress{ + position:fixed; + top:0; + left:0; + width:0%; + height:2px; + background-color:#47c; + transition:width 1s; + z-index:9999; +} +div.mine{background-color:rgba(255,192,0,0.6);} +div.detonated{background-color:rgba(255,0,0,0.6);} +div.flag{background-color:rgba(0,255,0,0.6);} +div.flagw{background-color:rgba(255,0,255,0.6);} +div.dug{background-color:rgba(160,160,192,0.8);} +div.normal{background-color:rgba(128,128,160,0.6);} +.one{color:#00f;} +.two{color:#008000;} +.three{color:#f00;} +.four{color:#000080;} +.five{color:#800000;} +.six{color:#008080;} +.seven{color:#000;} +.eight{color:#7e7e7e;} +</style> +<script> + function loadTheme(){ + var thm=document.cookie.replace(new RegExp("(?:(?:^|.*;\\s*)thm\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"); + if(thm.length<2||'0123z'.indexOf(thm[0])==-1||'abz'.indexOf(thm[1])==-1)thm='zz'; + var ent=""; + var d=new Date(); + if(thm[0]=='z') + { + var m=d.getMonth()+1; + if(m>=3&&m<6)thm='0'+thm[1]; + else if(m>=6&&m<9)thm='1'+thm[1]; + else if(m>=9&&m<12)thm='2'+thm[1]; + else thm='3'+thm[1]; + } + if(thm[1]=='z') + {if(d.getHours()>=18||d.getHours()<6)thm=thm[0]+'b';else thm=thm[0]+'a';} + ent=`theme${thm}`; + var R=new RegExp('theme[0-4][ab]'); + for(var i=0;i<document.styleSheets.length;++i) + { + if(R.exec(document.styleSheets[i].ownerNode.id)!==null&&document.styleSheets[i].ownerNode.id!=ent) + document.styleSheets[i].disabled=true; + else document.styleSheets[i].disabled=false; + } +} +loadTheme(); +</script> +</head> +<body onload="init();"> +<div id="progress"></div> +<div id="panel" class="TText"> + <ul id="panellist"> + <li><a href="/"><h1>Chrisoft</h1></a></li> + <li><span><h3>Minesweeper</h3></span></li> + <li><span> + Difficulty: + <select id="bsize" class="TText"> + <option value="1">Easy</option> + <option value="2">Normal</option> + <option value="3">Hard</option> + </select> + </li> + <li><span>Multimine: + <button id="multim" onclick="multiminetoggle();" class="off TText">Off</button></span> + </li> + <li><span>Effects: + <button id="efx" class="TText" onclick="efxtoggle();">On</button></span> + </li> + <li><span>Sounds: + <button id="sfx" class="TText" onclick="sfxtoggle();">On</button></span> + </li> + <!--<li><span>I can't count: + <button id="remm" class="TText" onclick="remmtoggle();">No thx</button></span> + </li>--> + <li><a href="javascript:void(0);" onclick="document.getElementById('help').style.opacity='1';document.getElementById('help').style.zIndex='1000';">Help</a></li> + <li><span>version: 0.8.8+b1</span></li> +</div> +<div id="OptionsContainer" class="TText"> + <button class="TText" id="start" onclick="gameInit();">New Game</button> + <button class="TText" id="st" onclick="systemtest();" style="display:none;" class="disabled">I'm ready, dismantle the mines!</button> + <br>Mines:<span id="mines"></span> +</div> +<div id="containerDiv"> +</div> +<div class="modal TText" style="opacity:0;text-align:center;z-index:-999;" id="result" onclick="this.style.opacity='0';this.style.zIndex='-999';"> +</div> +<div class="modal TText" style="opacity:0;z-index:-999;" id="help" onclick="this.style.opacity='0';this.style.zIndex='-999';"> + <p> + <b>Mobile devices from Apple are not supported...</b><br> + Left click / tap and hold on untouched cell = reveal cell<br> + Right click / tap on untouched cell = toggle flag in cell<br> + Right click / tap on revealed cell = reveal surrounding cells if feasible<br> + </p> + <p> + In multimine mode, there might be multiple (6 max) mines in a single cell. + Use right click or short tap to increase flag count, left click or long tap + to decrease flag count. To finish a multimine game, you have to flag all cells + with mines correctly and click the "I'm ready, dismantle the mines!" button. + </p> +</div> +</body> +</html> diff --git a/minesweeper/minesweeper.js b/minesweeper/minesweeper.js new file mode 100644 index 0000000..f4d652e --- /dev/null +++ b/minesweeper/minesweeper.js @@ -0,0 +1,428 @@ +//Chris Xiong 2017 +//Expat (MIT) License +var dimpx,dimx,dimy,cc,firstclick; +var cell=null; +var ismobile,effects=true,multimine=false,sfxe=true; +var dead,st,solved,animating,unc; +var dx=[-1,-1,-1, 0, 0, 1, 1, 1]; +var dy=[-1, 0, 1,-1, 1,-1, 0, 1]; +var classes=["one","two","three","four","five","six","seven","eight"]; +var queue=[],newqueue=[],flags=[],seed; +var mines=[],detx,dety,cmines=[],sfx=[]; +var ui={}; +function randomInt(min,max) +{ + seed*=214013;seed+=2531011;seed&=0xffffffff; + return min+(seed^seed>>15)%(max-min+1); +} +function setupui() +{ + ui.pbefx=document.getElementById('efx'); + ui.pbsfx=document.getElementById('sfx'); + ui.pbmul=document.getElementById('multim'); + ui.cbbsz=document.getElementById('bsize'); + ui.lbres=document.getElementById('result'); + ui.pbstt=document.getElementById('st'); + ui.lbmns=document.getElementById('mines'); + ui.cwctn=document.getElementById('containerDiv'); + ui.progress=document.getElementById('progress'); +} +function efxtoggle() +{ + effects=!effects; + ui.pbefx.classList.toggle('off'); + ui.pbefx.innerHTML=effects?"On":"Off"; + for(var i=0;i<dimx;++i) + for(var j=0;j<dimy;++j) + if(effects)cell[i][j].overlay.classList.add('trans'); + else cell[i][j].overlay.classList.remove('trans'); +} +function sfxtoggle() +{ + sfxe=!sfxe; + ui.pbsfx.classList.toggle('off'); + ui.pbsfx.innerHTML=sfxe?"On":"Off"; +} +function multiminetoggle() +{ + multimine=!multimine; + ui.pbmul.classList.toggle('off'); + ui.pbmul.innerHTML=multimine?"On":"Off"; + gameInit(); +} +function init() +{ + if( navigator.userAgent.match(/Android/i) + || navigator.userAgent.match(/webOS/i) + || navigator.userAgent.match(/iPhone/i) + || navigator.userAgent.match(/iPad/i) + || navigator.userAgent.match(/iPod/i) + || navigator.userAgent.match(/BlackBerry/i) + || navigator.userAgent.match(/Windows Phone/i) + ) + ismobile=true; + setupui();setupevents();gameInit(); + ui.cbbsz.onchange=gameInit; +} +function playsound(s,v) +{ + if(!sfxe)return;var i; + for(i=0;i<sfx.length;++i)if(!sfx[i])break; + if(i==sfx.length){sfx.push(new Audio(s));} + else sfx[i]=new Audio(s); + sfx[i].id=i;sfx[i].volume=v?v:.5; + sfx[i].onended=function(){sfx[this.id]=null;} + sfx[i].play(); +} +function gameInit(custx,custy,ccc) +{ + if((custx&&(custx>40||custx<3))||(custy&&(custy>40||custy<3))||(ccc&&custx&&custy&&(ccc>custx*custy-9))) + {console.log("Are you insane?");return;} + firstclick=true;dead=solved=false;for(var i=0;i<7;++i)flags[i]=cmines[i]=0; + ui.lbres.style.opacity="0";ui.lbres.style.zIndex="-999";animating=false; + for(;ui.cwctn.hasChildNodes();ui.cwctn.removeChild(ui.cwctn.lastChild)); + switch(ui.cbbsz.value) + { + case "1":dimx=9;dimy=9;cc=10;break; + case "2":dimx=16;dimy=16;cc=40;break; + case "3":dimx=16;dimy=30;cc=99;break; + } + if(custx&&custy&&ccc){dimx=custx;dimy=custy;cc=ccc;} + if((window.innerWidth>window.innerHeight)^(dimx<dimy)) + {var t=dimx;dimx=dimy;dimy=t;} + q=[];newqueue=[]; + updateflags();sfx=[];unc=0;ui.progress.style.width="0%"; + seed=Math.floor(Math.random()*2000000000); + if(multimine)ui.pbstt.style.display="inline-block"; + else ui.pbstt.style.display="none"; + ui.pbstt.classList.add("disabled"); + if(window.innerWidth/dimy*dimx>window.innerHeight*0.8) + { + dimpx=window.innerHeight*(ismobile?0.9:0.8); + ui.cwctn.style.width=dimpx/dimx*dimy+"px"; + ui.cwctn.style.height=dimpx+"px"; + } + else + { + dimpx=window.innerWidth*(ismobile?0.9:0.8); + ui.cwctn.style.width=dimpx+"px"; + ui.cwctn.style.height=dimpx/dimy*dimx+"px"; + } + cell=new Array(dimx+4);for(var i=0;i<dimx+4;++i)cell[i]=new Array(dimy+4); + for(var i=0;i<dimx;++i) + for(var j=0;j<dimy;++j) + { + cell[i][j]=document.createElement('div'); + cell[i][j].classList.add("clickable"); + cell[i][j].style.top=(i*100/dimx)+'%'; + cell[i][j].style.left=(j*100/dimy)+'%'; + cell[i][j].x=i;cell[i][j].y=j; + cell[i][j].s=cell[i][j].n=0; + cell[i][j].style.width=(95/dimy)+"%"; + cell[i][j].style.height=(95/dimx)+"%"; + cell[i][j].classList.add('normal'); + + cell[i][j].overlay=document.createElement('div'); + cell[i][j].overlay.classList.add("overlay"); + cell[i][j].overlay.style.top=(i*100/dimx)+'%'; + cell[i][j].overlay.style.left=(j*100/dimy)+'%'; + cell[i][j].overlay.style.width=(95/dimy)+"%"; + cell[i][j].overlay.style.height=(95/dimx)+"%"; + cell[i][j].overlay.style.opacity="0"; + cell[i][j].overlay.style.transform="scale(2,2)"; + if(effects)cell[i][j].overlay.classList.add("trans"); + + cell[i][j].span=document.createElement('span'); + cell[i][j].span.style.display="table-cell"; + cell[i][j].span.style.fontWeight="bold"; + cell[i][j].span.style.verticalAlign="middle"; + cell[i][j].span.style.userSelect="none"; + cell[i][j].span.classList.add("TText"); + cell[i][j].overlay.appendChild(cell[i][j].span); + cell[i][j].onclick=mclick; + cell[i][j].oncontextmenu=rclick; + ui.cwctn.appendChild(cell[i][j]); + ui.cwctn.appendChild(cell[i][j].overlay); + } +} +function genmines(sx,sy) +{ + mines=[];var s=[]; + for(var i=0;i<dimx;++i) + for(var j=0;j<dimy;++j) + if(Math.abs(sx-i)>=2||Math.abs(sy-j)>=2)s.push(i*dimy+j); + for(var i=0;i<cc;++i) + { + var t=randomInt(0,s.length-1); + var v=s[t]; + var x=Math.trunc(v/dimy),y=v%dimy; + s.splice(t,1); + cell[x][y].n=-1;mines.push(new pair(x,y)); + if(multimine) + { + var rnd=randomInt(1,100); + if(rnd>32)--cell[x][y].n; + if(rnd>57)--cell[x][y].n; + if(rnd>77)--cell[x][y].n; + if(rnd>87)--cell[x][y].n; + if(rnd>95)--cell[x][y].n; + } + ++cmines[-cell[x][y].n]; + for(var j=0;j<8;++j) + { + var cx=x+dx[j],cy=y+dy[j]; + if(cx>=0&&cx<dimx&&cy>=0&&cy<dimy&&cell[cx][cy].n>=0) + cell[cx][cy].n-=cell[x][y].n; + } + }st=new Date();updateflags(); +} +function mclick(e) +{ + e.preventDefault(); + if(dead||solved||animating)return; + var x=this.x,y=this.y; + if(ismobile) + { + if(multimine) + {if(cell[x][y].s>=0)flag(x,y);} + else{if(cell[x][y].s==1)deflag(x,y);else if(cell[x][y].s==0)flag(x,y);} + if(cell[x][y].s==-1)autodig(x,y); + } + else + { + if(cell[x][y].s==0)dig(x,y); + else if(cell[x][y].s==-1)autodig(x,y); + else if(multimine&&cell[x][y].s>0)deflag(x,y); + } +} +function rclick(e) +{ + e.preventDefault(); + if(dead||solved||animating)return; + var x=this.x,y=this.y; + if(ismobile) + { + if(cell[x][y].s==0)dig(x,y); + else if(multimine&&cell[x][y].s>0)deflag(x,y); + } + else + { + if(multimine) + {if(cell[x][y].s>=0)flag(x,y);} + else{if(cell[x][y].s==1)deflag(x,y);else if(cell[x][y].s==0)flag(x,y);} + } +} +function checksolved() +{ + for(var i=0;i<dimx;++i) + for(var j=0;j<dimy;++j) + if(cell[i][j].n>=0&&cell[i][j].s!=-1)return false; + return true; +} +var pair=function(_x,_y){this.x=_x;this.y=_y;} +pair.prototype.toString=function() +{ + return this.x+","+this.y; +} +function bfs(s) +{ + q=newqueue.slice(0);newqueue=[]; + if(s)playsound('ding.ogg'); + for(var i=0;i<q.length;++i) + { + var x=q[i].x,y=q[i].y; + if(cell[x][y].n<0){die(x,y);return;} + if(cell[x][y].n>0) + { + cell[x][y].span.innerHTML=cell[x][y].n; + cell[x][y].span.classList.add(classes[(cell[x][y].n-1)%8]); + } + cell[x][y].overlay.style.opacity="1"; + cell[x][y].overlay.style.transform="scale(1,1)"; + cell[x][y].overlay.classList.add("dug"); + ++unc; + ui.progress.style.width=100*unc/(dimx*dimy-cc)+"%"; + if(cell[x][y].n==0) + { + for(var j=0;j<8;++j) + { + var c=new pair(x+dx[j],y+dy[j]); + if(c.x>=0&&c.x<dimx&&c.y>=0&&c.y<dimy&&cell[c.x][c.y].s==0) + {newqueue.push(c);cell[c.x][c.y].s=-1;} + } + } + } + if(newqueue.length){if(effects)setTimeout(bfs,50,1);else bfs(0);} + else + { + animating=false; + if(checksolved()) + { + if(!multimine) + { + showresult(1); + }else ui.pbstt.classList.remove("disabled"); + } + } +} +function dig(x,y) +{ + if(firstclick){genmines(x,y);firstclick=false;} + if(cell[x][y].s==0) + { + newqueue.push(new pair(x,y)); + cell[x][y].s=-1;animating=true;bfs(1); + } +} +function autodig(x,y) +{ + if(cell[x][y].s!=-1)return; + var c=0; + for(var i=0;i<8;++i) + { + var cx=x+dx[i],cy=y+dy[i]; + if(cx>=0&&cx<dimx&&cy>=0&&cy<dimy&&cell[cx][cy].s>0)c+=cell[cx][cy].s; + } + if(c==cell[x][y].n) + { + newqueue=[]; + for(var i=0;i<8;++i) + { + var cx=x+dx[i],cy=y+dy[i]; + if(cx>=0&&cx<dimx&&cy>=0&&cy<dimy) + { + if(multimine&&cell[cx][cy].n<0&&cell[cx][cy].s!=-cell[cx][cy].n) + {die(cx,cy);return;} + if(cell[cx][cy].s==0){newqueue.push(new pair(cx,cy));cell[cx][cy].s=-1;} + } + } + if(newqueue.length){animating=true;bfs(1);} + } +} +function flag(x,y) +{ + --flags[cell[x][y].s];cell[x][y].s++; + if(multimine){if(cell[x][y].s>6)cell[x][y].s=6;cell[x][y].span.innerHTML=cell[x][y].s;} + else{if(cell[x][y].s>1)cell[x][y].s=1;cell[x][y].span.innerHTML="X";} + ++flags[cell[x][y].s]; + cell[x][y].overlay.classList.add('flag'); + cell[x][y].overlay.style.opacity="1"; + cell[x][y].overlay.style.transform="scale(1,1)"; + updateflags(); +} +function deflag(x,y) +{ + --flags[cell[x][y].s];--cell[x][y].s;++flags[cell[x][y].s]; + cell[x][y].span.innerHTML=cell[x][y].s; + if(cell[x][y].s==0) + { + cell[x][y].span.innerHTML=""; + cell[x][y].classList.remove('flag'); + cell[x][y].classList.add('normal'); + cell[x][y].overlay.style.opacity="0"; + cell[x][y].overlay.style.transform="scale(2,2)"; + } + updateflags(); +} +function updateflags() +{ + if(multimine) + { + var s=""; + for(var i=1;i<7;++i)s=s+" x"+i+" "+flags[i]+"/"+cmines[i]; + ui.lbmns.innerHTML=s; + } + else + ui.lbmns.innerHTML=flags[1]+"/"+cmines[1]; +} +function cmp(x,y) +{ + return (Math.abs(x.x-detx)+Math.abs(x.y-dety))-(Math.abs(y.x-detx)+Math.abs(y.y-dety)); +} +function die(x,y) +{ + if(dead||cell[x][y].n>=0)return; + dead=true;detx=x;dety=y;mines.sort(cmp); + for(var i=0;i<dimx;++i) + for(var j=0;j<dimy;++j) + if(cell[i][j].s>0&&cell[i][j].s!=-cell[i][j].n&&(i!=x||j!=y)) + { + cell[i][j].overlay.classList.remove('flag'); + cell[i][j].overlay.classList.add('flagw'); + cell[i][j].span.innerHTML="<s>"+cell[i][j].span.innerHTML+"</s>"; + } + cell[x][y].overlay.classList.add('detonated'); + cell[x][y].overlay.classList.remove('flag'); + cell[x][y].overlay.style.opacity="1"; + cell[x][y].overlay.style.transform="scale(1,1)"; + if(multimine) + { + if(-cell[x][y].n!=cell[x][y].s&&cell[x][y].s>0) + cell[x][y].span.innerHTML="<s>"+cell[x][y].s+"</s>"+(cell[x][y].n<0?-cell[x][y].n:""); + else cell[x][y].span.innerHTML=-cell[x][y].n; + } + var st=1;if(mines[1].toString()!=new pair(x,y).toString)st=0; + playsound('explode.ogg'); + if(effects)setTimeout(dieproc,10,st);else dieproc(st); + window.navigator.vibrate([200,100,300]); +} +function dieproc(p) +{ + if(!dead||p>=mines.length){if(p>=mines.length)showresult(0);ui.cwctn.style.transform="none";return;} + var x=mines[p].x,y=mines[p].y; + if(cell[x][y].n!=0&&cell[x][y].s==-cell[x][y].n)return dieproc(p+1); + if(sfxe&&(p%5==0))playsound('explode.ogg',.3*(1-p/cc/2)); + if(cell[x][y].s!=-cell[x][y].n) + { + cell[x][y].overlay.classList.add('mine'); + cell[x][y].overlay.classList.remove('flag'); + } + cell[x][y].overlay.style.opacity="1"; + cell[x][y].overlay.style.transform="scale(1,1)"; + if(multimine) + { + if(-cell[x][y].n!=cell[x][y].s&&cell[x][y].s>0) + cell[x][y].span.innerHTML="<s>"+cell[x][y].s+"</s>"+(cell[x][y].n<0?-cell[x][y].n:""); + else cell[x][y].span.innerHTML=-cell[x][y].n; + } + if(effects) + ui.cwctn.style.transform="translate("+(Math.random()*10-5)+"px,"+(Math.random()*10-5)+"px)"; + if(!effects||(cc>40&&(p&1)))dieproc(p+1);else setTimeout(dieproc,10,p+1); +} +function systemtest() +{ + if(ui.pbstt.classList.contains("disabled")||solved||dead)return; + for(var i=0;i<dimx;++i)for(var j=0;j<dimy;++j) + if(cell[i][j].n<0&&cell[i][j].s!=-cell[i][j].n){die(i,j);return;} + showresult(1); +} +function t() +{ + switch(ui.cbbsz.value) + { + case "1":return "easy"; + case "2":return "normal"; + case "3":return "hard"; + } +} +function showresult(w) +{ + ui.lbres.style.opacity="1";ui.lbres.style.zIndex="1000"; + if(w) + { + solved=true; + ui.lbres.innerHTML="<h3>Congratulations!</h3>You solved this "+t()+(multimine?" multimine":"")+" field in "+ + ((new Date()).getTime()-st.getTime())/1000.+" seconds!<br>Click or tap anywhere in the dialog to close it."; + } + else + { + var cs=0,ccor=0; + for(var i=0;i<dimx;++i)for(var j=0;j<dimy;++j) + { + if(cell[i][j].s==-cell[i][j].n&&cell[i][j].n<0)ccor+=cell[i][j].s; + if(cell[i][j].n<0)cs-=cell[i][j].n; + } + ui.lbres.innerHTML="<h3>Game Over!</h3>You uncovered "+(100*unc/(dimx*dimy-cc)).toFixed(2)+ + "% of the field and located "+(100*ccor/cs).toFixed(2)+"% mines correctly.<br>Click or tap anywhere in the dialog to close it." + } +} |