better infringement detection
This commit is contained in:
parent
4371164e45
commit
666fa8b511
1 changed files with 13 additions and 1 deletions
14
js/main.js
14
js/main.js
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue