lib/tunnel.js
// find all 1 unit squares along a tunnel's edge (useful for door placement)
find all 1 unit squares along a tunnel's edge (useful for door placement)
find all 1 unit squares along a tunnel ' s edge ( useful for door placement )
_findSquares(tunnelDirection) {
    let x, y
    const result = []
    if (tunnelDirection === 'NORTH') {
      for (({ x } = this), end = (this.x+this.tunnelWidth)-1, asc = this.x <= end; asc ? x <= end : x >= end; asc ? x++ : x--) {
        var asc, end
      result.push({ x, y: this.y-1, width: 1, height: 1 }) }
    } else if (tunnelDirection === 'SOUTH') {
      for (({ x } = this), end1 = (this.x+this.tunnelWidth)-1, asc1 = this.x <= end1; asc1 ? x <= end1 : x >= end1; asc1 ? x++ : x--) { var asc1, end1;
      result.push({ x, y: this.y+this.height, width: 1, height: 1 }) }
    } else if (tunnelDirection === 'EAST') {
      for (({ y } = this), end2 = (this.y+this.tunnelWidth)-1, asc2 = this.y <= end2; asc2 ? y <= end2 : y >= end2; asc2 ? y++ : y--) { var asc2, end2;
      result.push({x: this.x+this.width, y, width: 1, height: 1 }) }
    } else {
      for (({ y } = this), end3 = (this.y+this.tunnelWidth)-1, asc3 = this.y <= end3; asc3 ? y <= end3 : y >= end3; asc3 ? y++ : y--) { var asc3, end3;
      result.push({x: this.x-1, y, width: 1, height: 1 }) }
    }
    return result
  }
_findSquares ( tunnelDirection ) { let x , y const result = [ ] if ( tunnelDirection === 'NORTH' ) { for ( ( { x } = this ) , end = ( this . x + this . tunnelWidth ) - 1 , asc = this . x <= end ; asc ? x <= end : x >= end ; asc ? x ++ : x -- ) { var asc , end result . push ( { x , y : this . y - 1 , width : 1 , height : 1 } ) } } else if ( tunnelDirection === 'SOUTH' ) { for ( ( { x } = this ) , end1 = ( this . x + this . tunnelWidth ) - 1 , asc1 = this . x <= end1 ; asc1 ? x <= end1 : x >= end1 ; asc1 ? x ++ : x -- ) { var asc1 , end1 ; result . push ( { x , y : this . y + this . height , width : 1 , height : 1 } ) } } else if ( tunnelDirection === 'EAST' ) { for ( ( { y } = this ) , end2 = ( this . y + this . tunnelWidth ) - 1 , asc2 = this . y <= end2 ; asc2 ? y <= end2 : y >= end2 ; asc2 ? y ++ : y -- ) { var asc2 , end2 ; result . push ( { x : this . x + this . width , y , width : 1 , height : 1 } ) } } else { for ( ( { y } = this ) , end3 = ( this . y + this . tunnelWidth ) - 1 , asc3 = this . y <= end3 ; asc3 ? y <= end3 : y >= end3 ; asc3 ? y ++ : y -- ) { var asc3 , end3 ; result . push ( { x : this . x - 1 , y , width : 1 , height : 1 } ) } } return result }
find all 1 unit squares along a tunnel's edge (useful for door placement)
find all 1 unit squares along a tunnel ' s edge ( useful for door placement )