<commit_before>"use strict";

var renderer, scene, camera;

var CityConfig = (function() {
  var config = {};

  config.STREET_WIDTH = 3;
  config.STREET_DEPTH = 3;
  config.BLOCK_WIDTH = 8;
  config.BLOCK_DEPTH = 8;
  config.BLOCK_ROWS = 64;
  config.BLOCK_COLUMNS = 64;
  config.MIN_BUILDING_HEIGHT = 1.2;
  config.MAX_BUILDING_HEIGHT = 40;
  config.MAX_BUILDING_MATERIALS = 50;
  config.TOTAL_SCENE_WIDTH = (config.BLOCK_WIDTH * config.BLOCK_COLUMNS) + (config.STREET_WIDTH * (config.BLOCK_COLUMNS - 1));
  config.HALF_SCENE_WIDTH = config.TOTAL_SCENE_WIDTH / 2;
  config.TOTAL_SCENE_DEPTH = (config.BLOCK_DEPTH * config.BLOCK_ROWS) + (config.STREET_DEPTH * (config.BLOCK_ROWS - 1));
  config.HALF_SCENE_DEPTH = config.TOTAL_SCENE_DEPTH / 2;

  return config;
})();

var Coordinates = (function() {
  var HALF_COLUMNS = CityConfig.BLOCK_COLUMNS / 2;
  var HALF_ROWS = CityConfig.BLOCK_ROWS / 2;

  var coordinates = {};

  coordinates.mapXToSceneX = function(mapX) {
    var cartesianMapX = mapX - HALF_COLUMNS;
    return (cartesianMapX * CityConfig.BLOCK_WIDTH) + (cartesianMapX * CityConfig.STREET_WIDTH);
  };

  coordinates.mapZToSceneZ = function(mapZ) {
    var cartesianMapZ = mapZ - HALF_ROWS;
    return (cartesianMapZ * CityConfig.BLOCK_DEPTH) + (cartesianMapZ * CityConfig.STREET_DEPTH);
  };

  coordinates.sceneXToMapX = function(sceneX) {
    var cartesianMapX = sceneX / (CityConfig.BLOCK_WIDTH + CityConfig.STREET_WIDTH);
    return cartesianMapX + HALF_COLUMNS;
  };

  coordinates.sceneZToMapZ = function(sceneZ) {
    var cartesianMapZ = sceneZ / (CityConfig.BLOCK_DEPTH + CityConfig.STREET_DEPTH);
    return cartesianMapZ + HALF_ROWS;
  };

  return coordinates;
})();

function detectWebGL() {
  if (!window.WebGLRenderingContext) {
    return false;
  }

  // Adapted from https://github.com/Modernizr/Modernizr/blob/master/feature-detects/webgl-extensions.js
  var canvas = document.createElement('canvas');<commit_msg>Simplifying expressions<commit_after>"use strict";

var renderer, scene, camera;

var CityConfig = (function() {
  var config = {};

  config.STREET_WIDTH = 3;
  config.STREET_DEPTH = 3;
  config.BLOCK_WIDTH = 8;
  config.BLOCK_DEPTH = 8;
  config.BLOCK_ROWS = 64;
  config.BLOCK_COLUMNS = 64;
  config.MIN_BUILDING_HEIGHT = 1.2;
  config.MAX_BUILDING_HEIGHT = 40;
  config.MAX_BUILDING_MATERIALS = 50;
  config.TOTAL_SCENE_WIDTH = (config.BLOCK_WIDTH * config.BLOCK_COLUMNS) + (config.STREET_WIDTH * (config.BLOCK_COLUMNS - 1));
  config.HALF_SCENE_WIDTH = config.TOTAL_SCENE_WIDTH / 2;
  config.TOTAL_SCENE_DEPTH = (config.BLOCK_DEPTH * config.BLOCK_ROWS) + (config.STREET_DEPTH * (config.BLOCK_ROWS - 1));
  config.HALF_SCENE_DEPTH = config.TOTAL_SCENE_DEPTH / 2;

  return config;
})();

var Coordinates = (function() {
  var HALF_COLUMNS = CityConfig.BLOCK_COLUMNS / 2;
  var HALF_ROWS = CityConfig.BLOCK_ROWS / 2;

  var coordinates = {};

  coordinates.mapXToSceneX = function(mapX) {
    var cartesianMapX = mapX - HALF_COLUMNS;
    return cartesianMapX * (CityConfig.BLOCK_WIDTH + CityConfig.STREET_WIDTH);
  };

  coordinates.mapZToSceneZ = function(mapZ) {
    var cartesianMapZ = mapZ - HALF_ROWS;
    return cartesianMapZ * (CityConfig.BLOCK_DEPTH + CityConfig.STREET_DEPTH);
  };

  coordinates.sceneXToMapX = function(sceneX) {
    var cartesianMapX = sceneX / (CityConfig.BLOCK_WIDTH + CityConfig.STREET_WIDTH);
    return cartesianMapX + HALF_COLUMNS;
  };

  coordinates.sceneZToMapZ = function(sceneZ) {
    var cartesianMapZ = sceneZ / (CityConfig.BLOCK_DEPTH + CityConfig.STREET_DEPTH);
    return cartesianMapZ + HALF_ROWS;
  };

  return coordinates;
})();

function detectWebGL() {
  if (!window.WebGLRenderingContext) {
    return false;
  }

  // Adapted from https://github.com/Modernizr/Modernizr/blob/master/feature-detects/webgl-extensions.js
  var canvas = document.createElement('canvas');
{'fraction_non_alphanumeric': 0.11478800413650465, 'fraction_numerical': 0.010341261633919338, 'mean_word_length': 4.3292011019283745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3974415', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1415, 'n_words': 234}