<commit_before>var Game = Game || {};

Game.SquareInvaders = function(options) {
  'use strict';
  var playerOptions;
  this.width = options.width || 1280;
  this.height = options.height || 640;
  this.pause = false;
  playerOptions = {
    width: 20,
    height: 20,
    canvasWidth: this.width,
    canvasHeight: this.height,
    xSpeed: 10,
    ySpeed: 10,
    x: this.width / 2,
    y: this.height - 20
  };
  this.player = new Game.Player(playerOptions);
  this.enemies = [];
  this.spawnWait = 0;
};

Game.SquareInvaders.prototype.update = function(inputHandler) {
  'use strict';
  var enemyOptions = {
    x: Math.random() * this.width,
    y: 0
  };

  this.player.hit = false;
  if (inputHandler.pressed && inputHandler.keysDown[inputHandler.KEY.ESC] && !this.player.dead) {
    this.pause = !this.pause;
  }

  if (!this.pause && !this.player.dead) {
    Game.collisionCheck(this.player, this.enemies);
    this.player.update(inputHandler);
    this.enemies = this.enemies.filter(function(enemy) {
      enemy.update();
      return !enemy.dead;
    });

    if (this.enemies.length <= 15 && this.spawnWait === 0) {
      if (this.player.score < 100) {
        this.enemies.push(new Game.BasicEnemy(enemyOptions));
      } else if (this.player.score >= 100 && this.player.score <= 250) {
        this.enemies.push(new Game.SolidEnemy(enemyOptions));
      } else if (this.player.score > 250) {
        this.enemies.push(new Game.BasicEnemy(enemyOptions));
        this.enemies.push(new Game.SolidEnemy(enemyOptions));
      }
      this.spawnWait = 50;
    }
    if (this.spawnWait > 0) {
      this.spawnWait -= 1;
    }
  }
};

Game.SquareInvaders.prototype.render = function(context) {
  'use strict';<commit_msg>Use isDown function for consistency and clarity<commit_after>var Game = Game || {};

Game.SquareInvaders = function(options) {
  'use strict';
  var playerOptions;
  this.width = options.width || 1280;
  this.height = options.height || 640;
  this.pause = false;
  playerOptions = {
    width: 20,
    height: 20,
    canvasWidth: this.width,
    canvasHeight: this.height,
    xSpeed: 10,
    ySpeed: 10,
    x: this.width / 2,
    y: this.height - 20
  };
  this.player = new Game.Player(playerOptions);
  this.enemies = [];
  this.spawnWait = 0;
};

Game.SquareInvaders.prototype.update = function(inputHandler) {
  'use strict';
  var enemyOptions = {
    x: Math.random() * this.width,
    y: 0
  };

  this.player.hit = false;
  if (inputHandler.pressed && inputHandler.isDown('ESC') && !this.player.dead) {
    this.pause = !this.pause;
  }

  if (!this.pause && !this.player.dead) {
    Game.collisionCheck(this.player, this.enemies);
    this.player.update(inputHandler);
    this.enemies = this.enemies.filter(function(enemy) {
      enemy.update();
      return !enemy.dead;
    });

    if (this.enemies.length <= 15 && this.spawnWait === 0) {
      if (this.player.score < 100) {
        this.enemies.push(new Game.BasicEnemy(enemyOptions));
      } else if (this.player.score >= 100 && this.player.score <= 250) {
        this.enemies.push(new Game.SolidEnemy(enemyOptions));
      } else if (this.player.score > 250) {
        this.enemies.push(new Game.BasicEnemy(enemyOptions));
        this.enemies.push(new Game.SolidEnemy(enemyOptions));
      }
      this.spawnWait = 50;
    }
    if (this.spawnWait > 0) {
      this.spawnWait -= 1;
    }
  }
};

Game.SquareInvaders.prototype.render = function(context) {
  'use strict';
{'fraction_non_alphanumeric': 0.15096513972918468, 'fraction_numerical': 0.02247191011235955, 'mean_word_length': 2.8880179171332587, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '1051448', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1192, 'n_words': 223}