Simple Minesweeper without flagging. Uncover all the cells except the mines and you Win! Click on a mine and you lose =( There are 8 mines per game. Good Luck!
var g=30,z=[],f=Math.floor,x,y,t,l=0,n=[-9,-8,-7,-1,1,7,8,9],tn=[-8,-7,1,8,9],bn=[-9,-8,-1,7,8],d=0,v;c.width=8*g;c.height=8*g;function rC(q,i,r,e){x=f(i/8);y=i%8;if(e&&q.s!='d'){q.s='d';d++;if(d==56){alert('You Win');u();return;}} if(e&&q.m){alert('You Lose');q.s='m';u();return;} a.clearRect(x*g,y*g,g,g);a.fillStyle='#833';switch(q.s){case'd':a.fillText(q.c,x*g+10,y*g+12);break;case'u':a.fillRect(x*g+2,y*g+2,g-4,g-4);} if(e&&q.c==0){rq(cf,i);}} function cf(c,i){c.forEach(function(q){v=q+i;if((v>-1&&v<64)&&z[v].s!='d'&&!z[v].m){rC(z[v],v,[],true);}})} function pf(c,i){c.forEach(function(q){v=q+i;if(v>-1&&v<64){z[v].c++;}});} function rq(q,l){if(l%8==0)q(tn,l);else if(l%8==7)q(bn,l);else q(n,l);} function pl(){l=f(Math.random()*63);if(z[l].m) return pl();return l;} function u(){z=[];d=0;for(var i=0;i<64;i++){z.push({s:'u',c:0,m:0})} for(var i=0;i<8;i++){l=pl();z[l].m=1;rq(pf,l);} z.forEach(rC);} u();c.onmousedown=function(e){t=f(e.clientX/g)*8+f(e.clientY/g);rC(z[t],t,[],true);};
dmFyIGc9MzAsej1bXSxmPU1hdGguZmxvb3IseCx5LHQsbD0wLG49Wy05LC04LC03LC0xLDEsNyw4LDldLHRuPVstOCwtNywxLDgsOV0sYm49Wy05LC04LC0xLDcsOF0sZD0wLHY7Yy53aWR0aD04Kmc7Yy5oZWlnaHQ9OCpnO2Z1bmN0aW9uIHJDKHEsaSxyLGUpe3g9ZihpLzgpO3k9aSU4O2lmKGUmJnEucyE9J2QnKXtxLnM9J2QnO2QrKztpZihkPT01Nil7YWxlcnQoJ1lvdSBXaW4nKTt1KCk7cmV0dXJuO319IGlmKGUmJ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bn=[-9,-8,-1,7,8],d=0,v;
c.width = 8*g;
c.height = 8*g;
function rC(q,i,r,e) {
x=f(i/8);y=i%8;
if(e&&q.s!='d'){q.s='d';d++;if(d==56){alert('You Win');u();return;}}
if(e&&q.m){alert('You Lose');q.s='m';u();return;}
a.clearRect(x*g,y*g,g,g);
a.fillStyle = '#833';
switch(q.s) {
case 'd':
a.fillText(q.c,x*g+10,y*g+12);
break;
case 'u':
a.fillRect(x*g+2,y*g+2,g-4,g-4);
}
if(e&&q.c==0){
rq(cf,i);
}
}
function cf(c,i) {
c.forEach(function(q){v=q+i;if((v>-1&&v<64)&&z[v].s!='d'&&!z[v].m){rC(z[v],v,[],true);}})
}
function pf(c,i) {
c.forEach(function(q){v=q+i;if(v>-1&&v<64){z[v].c++;}});
}
function rq(q,l){
if(l%8==0)q(tn,l);
else if(l%8==7)q(bn,l);
else q(n,l);
}
function pl(){
l=f(Math.random()*63);
if(z[l].m)
return pl();
return l;
}
function u() {
z=[];d=0;
for(var i = 0; i < 64; i++){z.push({s:'u',c:0,m:0})}
for(var i = 0; i < 8; i++){l=pl();z[l].m=1;rq(pf,l);}
z.forEach(rC);
}
u();
c.onmousedown = function(e){t=f(e.clientX/g)*8+f(e.clientY/g); rC(z[t],t,[],true);};