function identifyFullLines(callback) {
  var fullLines = [];
  for (var y = 0; y < grid.length; y++) {
    if (grid[y].indexOf(null) === -1) {
      fullLines.push(y);
    }
  }
  if (fullLines.length === 0) {
    // No full lines, finish early.
    callback();
    return;
  }
  mode = modes.STOPPED;
  // Compile list of all blocks to delete.
  recalculateSpeed();
  var deleteBlocks = [];
  for (var i = 0; i < fullLines.length; i++) {
    var y = fullLines[i];
    for (var x = 0; x < grid[y].length; x++) {
      deleteBlocks.push(grid[y][x]);
    }
  }
  // Highlight full lines.
  deleteBlocks.map(function(block) {block.setAttribute('filter', 'url(#fullLineFilter)');});
  setTimeout(deleteFullLines.bind(null, fullLines, deleteBlocks, callback),
             FULL_LINE_TIME);
}
// Identify which lines are full.
Identify which lines are full.
Identify which lines are full .
function identifyFullLines(callback) {
  var fullLines = [];
  for (var y = 0; y < grid.length; y++) {
    if (grid[y].indexOf(null) === -1) {
      fullLines.push(y);
    }
  }
  if (fullLines.length === 0) {
    callback();
    return;
  }
  mode = modes.STOPPED;
  recalculateSpeed();
  var deleteBlocks = [];
  for (var i = 0; i < fullLines.length; i++) {
    var y = fullLines[i];
    for (var x = 0; x < grid[y].length; x++) {
      deleteBlocks.push(grid[y][x]);
    }
  }
  deleteBlocks.map(function(block) {block.setAttribute('filter', 'url(#fullLineFilter)');});
  setTimeout(deleteFullLines.bind(null, fullLines, deleteBlocks, callback),
             FULL_LINE_TIME);
}
function identifyFullLines ( callback ) { var fullLines = [ ] ; for ( var y = 0 ; y < grid . length ; y ++ ) { if ( grid [ y ] . indexOf ( null ) === - 1 ) { fullLines . push ( y ) ; } } if ( fullLines . length === 0 ) { callback ( ) ; return ; } mode = modes . STOPPED ; recalculateSpeed ( ) ; var deleteBlocks = [ ] ; for ( var i = 0 ; i < fullLines . length ; i ++ ) { var y = fullLines [ i ] ; for ( var x = 0 ; x < grid [ y ] . length ; x ++ ) { deleteBlocks . push ( grid [ y ] [ x ] ) ; } } deleteBlocks . map ( function ( block ) { block . setAttribute ( 'filter' , 'url(#fullLineFilter)' ) ; } ) ; setTimeout ( deleteFullLines . bind ( null , fullLines , deleteBlocks , callback ) , FULL_LINE_TIME ) ; }
Identify which lines are full.
Identify which lines are full .
// No full lines, finish early. // Compile list of all blocks to delete. // Highlight full lines.