app/scripts/core/gameCoordinator.js
/**
   * Recursive method which determines the largest possible scale the game's graphics can use
   * @param {Number} scale
   */
Recursive method which determines the largest possible scale the game's graphics can use
@param {Number} scale
Recursive method which determines the largest possible scale the game ' s graphics can use @param { Number } scale
determineScale(scale) {
    const availableScreenHeight = Math.min(
      document.documentElement.clientHeight,
      window.innerHeight || 0,
    );
    const availableScreenWidth = Math.min(
      document.documentElement.clientWidth,
      window.innerWidth || 0,
    );
    const scaledTileSize = this.tileSize * scale;
    const mazeTileHeight = this.mazeArray.length + 5;
    const mazeTileWidth = this.mazeArray[0][0].split('').length;
    if (
      scaledTileSize * mazeTileHeight < availableScreenHeight
      && scaledTileSize * mazeTileWidth < availableScreenWidth
    ) {
      return this.determineScale(scale + 1);
    }
    return scale - 1;
  }
determineScale ( scale ) { const availableScreenHeight = Math . min ( document . documentElement . clientHeight , window . innerHeight || 0 , ) ; const availableScreenWidth = Math . min ( document . documentElement . clientWidth , window . innerWidth || 0 , ) ; const scaledTileSize = this . tileSize * scale ; const mazeTileHeight = this . mazeArray . length + 5 ; const mazeTileWidth = this . mazeArray [ 0 ] [ 0 ] . split ( '' ) . length ; if ( scaledTileSize * mazeTileHeight < availableScreenHeight && scaledTileSize * mazeTileWidth < availableScreenWidth ) { return this . determineScale ( scale + 1 ) ; } return scale - 1 ; }
Recursive method which determines the largest possible scale the game's graphics can use
 @param {Number} scale
Recursive method which determines the largest possible scale the game ' s graphics can use @param { Number } scale
// The original Pac-Man game leaves 5 tiles of height (3 above, 2 below) surrounding the // maze for the UI. See app\style\graphics\spriteSheets\references\mazeGridSystemReference.png // for reference.