function lockDown() {
  clearInterval(fallPid);
  // Check for "lock out" game over condition (whole shape above skyline).
  var below = false;
  for (var i = 0, coord; (coord = currentShape.coords[i]); i++) {
    if (coord[1] < ROWS) {
      below = true;
      break;
    }
  }
  if (!below) {
    console.log('Game over: Lock out.');
    fail();
    return;
  }
  // Create static blocks which look identical to the fallen shape.
  var g = document.getElementById('matrix');
  for (var i = 0, coord; (coord = currentShape.coords[i]); i++) {
    var x = coord[0];
    var y = coord[1];
    var b = createBlock();
    b.setAttribute('x', SQUARE_SIZE * x + BORDER_WIDTH);
    b.setAttribute('y', SQUARE_SIZE * (ROWS - y - 1) + TOP_ROW_HEIGHT);
    b.classList.add('type_' + currentShape.type);
    g.appendChild(b);
    grid[y][x] = b;
  }
  // Destroy the fallen shape.
  currentShape.destroy();
  identifyFullLines(createShape);
}
// Freeze a falling shape in place.
Freeze a falling shape in place.
Freeze a falling shape in place .
function lockDown() {
  clearInterval(fallPid);
  var below = false;
  for (var i = 0, coord; (coord = currentShape.coords[i]); i++) {
    if (coord[1] < ROWS) {
      below = true;
      break;
    }
  }
  if (!below) {
    console.log('Game over: Lock out.');
    fail();
    return;
  }
  var g = document.getElementById('matrix');
  for (var i = 0, coord; (coord = currentShape.coords[i]); i++) {
    var x = coord[0];
    var y = coord[1];
    var b = createBlock();
    b.setAttribute('x', SQUARE_SIZE * x + BORDER_WIDTH);
    b.setAttribute('y', SQUARE_SIZE * (ROWS - y - 1) + TOP_ROW_HEIGHT);
    b.classList.add('type_' + currentShape.type);
    g.appendChild(b);
    grid[y][x] = b;
  }
  currentShape.destroy();
  identifyFullLines(createShape);
}
function lockDown ( ) { clearInterval ( fallPid ) ; var below = false ; for ( var i = 0 , coord ; ( coord = currentShape . coords [ i ] ) ; i ++ ) { if ( coord [ 1 ] < ROWS ) { below = true ; break ; } } if ( ! below ) { console . log ( 'Game over: Lock out.' ) ; fail ( ) ; return ; } var g = document . getElementById ( 'matrix' ) ; for ( var i = 0 , coord ; ( coord = currentShape . coords [ i ] ) ; i ++ ) { var x = coord [ 0 ] ; var y = coord [ 1 ] ; var b = createBlock ( ) ; b . setAttribute ( 'x' , SQUARE_SIZE * x + BORDER_WIDTH ) ; b . setAttribute ( 'y' , SQUARE_SIZE * ( ROWS - y - 1 ) + TOP_ROW_HEIGHT ) ; b . classList . add ( 'type_' + currentShape . type ) ; g . appendChild ( b ) ; grid [ y ] [ x ] = b ; } currentShape . destroy ( ) ; identifyFullLines ( createShape ) ; }
Freeze a falling shape in place.
Freeze a falling shape in place .
// Check for "lock out" game over condition (whole shape above skyline). // Create static blocks which look identical to the fallen shape. // Destroy the fallen shape.