<commit_before>function Game() {

  Game.prototype.frames = {1:[1,2], 2:[1,2], 3:[1,2], 4:[1,2], 5:[1,2],
    6:[1,2], 7:[1,2], 8:[1,2], 9:[1,2], 10:[1,2]};

  Game.prototype.currentFrame = 1;
  Game.prototype.currentRoll = 1;
  Game.prototype.pins = 10;
  Game.prototype.score = 0;

  Game.prototype.returnCurrentFrame = function() {
    return this.currentFrame;
  }

  Game.prototype.roll = function() {
    var roll = Math.floor(Math.random() * 11);
    this.pins -= roll;
    this.score += roll;

    if (this.currentRoll === 1) {
      this.isStrike(roll);
    } else {
      this.currentRoll --;
      this.currentFrame ++;
    }
    return roll;
  }

  Game.prototype.isStrike = function(roll) {
    if (roll === 10) {
      this.currentFrame++;
      this.currentRoll = 1;
    } else {
      this.currentRoll ++;
    }
  }


}<commit_msg>Refactor<commit_after>function Game() {

  Game.prototype.frames = {1:[1,2], 2:[1,2], 3:[1,2], 4:[1,2], 5:[1,2],
    6:[1,2], 7:[1,2], 8:[1,2], 9:[1,2], 10:[1,2]};

  Game.prototype.currentFrame = 1;
  Game.prototype.currentRoll = 1;
  Game.prototype.pins = 10;
  Game.prototype.score = 0;

  Game.prototype.returnCurrentFrame = function() {
    return this.currentFrame;
  }

  Game.prototype.roll = function() {
    var roll = Math.floor(Math.random() * 11);
    this.adjustScoreAndPins(roll);

    if (this.currentRoll === 1) {
      this.isStrike(roll);
    } else {
      this.switchFrame();
    }
    return roll;
  }

  Game.prototype.isStrike = function(roll) {
    if (roll === 10) {
      this.currentFrame++;
      this.currentRoll = 1;
    } else {
      this.currentRoll ++;
    }
  }

  Game.prototype.adjustScoreAndPins = function(roll) {
    this.pins -= roll;
    this.score += roll;
  }

  Game.prototype.switchFrame = function() {
    this.currentRoll --;
    this.currentFrame ++;
  }


}
{'fraction_non_alphanumeric': 0.18544474393530996, 'fraction_numerical': 0.045283018867924525, 'mean_word_length': 2.719438877755511, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5657509', 'n_tokens_mistral': 754, 'n_tokens_neox': 672, 'n_words': 114}