better infringement detection

This commit is contained in:
garrettdreyfus 2014-05-25 20:34:56 -04:00
parent 4371164e45
commit 666fa8b511

View file

@ -365,10 +365,22 @@ function animLoop() {
}
requestAnimFrame(animLoop);
function isInfringing(clock){
for(var i=0;i<clock.sides;i++){
var subTotal=0;
for(var j=0;j<clock.blocks[i].length;j++){
subTotal+=clock.blocks[i][j].deleted ;
}
if(clock.blocks[i].length- subTotal>settings.rows){
return true;
}
}
return false;
}
function checkGameOver() {
for (var i = 0; i < MainClock.sides; i++) {
if (MainClock.blocks[i].length > settings.rows) {
if (isInfringing(MainClock)) {
return true;
}
}