function newGame() {
  clearTimeout(timeoutPID);
  cancelAnimationFrame(animationPID);
  var explodeGroup = document.getElementById('explode');
  while(explodeGroup.firstChild) {
    explodeGroup.removeChild(explodeGroup.firstChild);
  }
  liveField = new Field();
  for (var x = 0; x < WIDTH; x++) {
    for (var y = 0; y < HEIGHT; y++) {
      drawSquare(liveField.getSquare(x, y));
    }
  }
  turn = 1;
  startNextTurn();
}
// Terminate and clear any existing game and start a new game.
Terminate and clear any existing game and start a new game.
Terminate and clear any existing game and start a new game .
function newGame() {
  clearTimeout(timeoutPID);
  cancelAnimationFrame(animationPID);
  var explodeGroup = document.getElementById('explode');
  while(explodeGroup.firstChild) {
    explodeGroup.removeChild(explodeGroup.firstChild);
  }
  liveField = new Field();
  for (var x = 0; x < WIDTH; x++) {
    for (var y = 0; y < HEIGHT; y++) {
      drawSquare(liveField.getSquare(x, y));
    }
  }
  turn = 1;
  startNextTurn();
}
function newGame ( ) { clearTimeout ( timeoutPID ) ; cancelAnimationFrame ( animationPID ) ; var explodeGroup = document . getElementById ( 'explode' ) ; while ( explodeGroup . firstChild ) { explodeGroup . removeChild ( explodeGroup . firstChild ) ; } liveField = new Field ( ) ; for ( var x = 0 ; x < WIDTH ; x ++ ) { for ( var y = 0 ; y < HEIGHT ; y ++ ) { drawSquare ( liveField . getSquare ( x , y ) ) ; } } turn = 1 ; startNextTurn ( ) ; }
Terminate and clear any existing game and start a new game.
Terminate and clear any existing game and start a new game .