From 4bdc3c48ff9b5c767276b1588ec38006338569a1 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Mon, 12 Jun 2017 15:15:08 +0800 Subject: 0.8.8: Progress bar & queue initialization fix. --- minesweeper.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'minesweeper.js') diff --git a/minesweeper.js b/minesweeper.js index b7984fa..651e6e1 100644 --- a/minesweeper.js +++ b/minesweeper.js @@ -1,9 +1,9 @@ //Chris Xiong 2017 -//The MIT License +//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; +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"]; @@ -25,6 +25,7 @@ function setupui() ui.pbstt=document.getElementById('st'); ui.lbmns=document.getElementById('mines'); ui.cwctn=document.getElementById('containerDiv'); + ui.progress=document.getElementById('progress'); } function efxtoggle() { @@ -40,7 +41,7 @@ function sfxtoggle() { sfxe=!sfxe; ui.pbsfx.classList.toggle('off'); - ui.pbsfx.innerHTML=effects?"On":"Off"; + ui.pbsfx.innerHTML=sfxe?"On":"Off"; } function multiminetoggle() { @@ -75,7 +76,7 @@ function playsound(s,v) } function gameInit(custx,custy,ccc) { - if((custx&&custx>40)||(custy&&custy>40)||(ccc&&custx&&custy&&(ccc>custx*custy-9))) + 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; @@ -89,7 +90,8 @@ function gameInit(custx,custy,ccc) if(custx&&custy&&ccc){dimx=custx;dimy=custy;cc=ccc;} if((window.innerWidth>window.innerHeight)^(dimx=0)++uc; } - ui.lbres.innerHTML="

Game Over!

You uncovered "+(100*uc/(dimx*dimy-cc)).toFixed(2)+ + ui.lbres.innerHTML="

Game Over!

You uncovered "+(100*unc/(dimx*dimy-cc)).toFixed(2)+ "% of the field and located "+(100*ccor/cs).toFixed(2)+"% mines correctly.
Click or tap anywhere in the dialog to close it." } } -- cgit v1.2.3