function initBorders() {
  var doorWidth = 3;  // Approximately one half the width of the door.
  for (var x = 0; x < WIDTH; x++) {
    if (Math.abs(x - WIDTH / 2) < doorWidth) {
      continue;
    }
    getCell([x, 0]).className = 'border';
    getCell([x, HEIGHT - 1]).className = 'border';
  }
  for (var y = 1; y < HEIGHT - 1; y++) {
    if (Math.abs(y - HEIGHT / 2) < doorWidth) {
      continue;
    }
    getCell([WIDTH - 1, y]).className = 'border';
    getCell([0, y]).className = 'border';
  }
}
// Create the borders.  Only done once.
Create the borders.  Only done once.
Create the borders . Only done once .
function initBorders() {
  var doorWidth = 3;  
  for (var x = 0; x < WIDTH; x++) {
    if (Math.abs(x - WIDTH / 2) < doorWidth) {
      continue;
    }
    getCell([x, 0]).className = 'border';
    getCell([x, HEIGHT - 1]).className = 'border';
  }
  for (var y = 1; y < HEIGHT - 1; y++) {
    if (Math.abs(y - HEIGHT / 2) < doorWidth) {
      continue;
    }
    getCell([WIDTH - 1, y]).className = 'border';
    getCell([0, y]).className = 'border';
  }
}
function initBorders ( ) { var doorWidth = 3 ; for ( var x = 0 ; x < WIDTH ; x ++ ) { if ( Math . abs ( x - WIDTH / 2 ) < doorWidth ) { continue ; } getCell ( [ x , 0 ] ) . className = 'border' ; getCell ( [ x , HEIGHT - 1 ] ) . className = 'border' ; } for ( var y = 1 ; y < HEIGHT - 1 ; y ++ ) { if ( Math . abs ( y - HEIGHT / 2 ) < doorWidth ) { continue ; } getCell ( [ WIDTH - 1 , y ] ) . className = 'border' ; getCell ( [ 0 , y ] ) . className = 'border' ; } }
Create the borders.
Create the borders .
// Approximately one half the width of the door.