<commit_before>var Game = function() {
  this.finalScore = 0;
  this.bowlsLeftInFrame = 2;
  this.frame = 1;
  this.spare = null;
  this.strike = null;
  this.firstBall = null;
};

Game.prototype.bowl = function(score) {
  if(this.frame > 11) {
    return
  }

  if(this.isSpareInTenthFrame(score)) {
    this.spare = true;
    this.advanceToNextFrame();
    this.bowlsLeftInFrame = 1;
    this.addScoreToFinalScore(score);
    return
  }

  if(this.isEleventhFrame() && this.bowlsLeftInFrame > 0) {
    if(this.spare === true) {
      this.addScoreToFinalScore(score);
      this.bowlsLeftInFrame -= 1;

      if(this.strike === true) { 
        this.addScoreToFinalScore(score);
      }
    }

    if(this.strike === true) {
      if(this.isFirstBall()) {
        this.finalScore += (score * 2);
        this.advanceToNextBall();
        return
      }

      if(this.isSecondBall()) {
        this.finalScore += (score * 2);
        this.advanceToNextFrame();
        return
      }
    }
  }

  if(this.isNotEleventhFrame()) {
    
    if(this.isFirstBall()) {
      if(score === 10) {
        this.strike = true;
        this.addScoreToFinalScore(score); //10
        this.advanceToNextFrame();
        return
      }

      if(this.strike === true) {
        this.finalScore += (score * 2);
        this.advanceToNextBall();
        return
      }

      if(this.spare === true) {
        this.finalScore += (score + this.firstBall);
        this.spare = null;
        this.advanceToNextBall();
        return
      } else {
        this.firstBall = score;
        this.addScoreToFinalScore(score);
        this.advanceToNextBall();
        return
      }
    }

    if(this.isSecondBall()) {
      if(this.strike === true) {
        this.finalScore += (score * 2);
        this.strike = null;
        this.advanceToNextFrame();
        return
      }

      if(this.firstBall + score === 10) {
        this.spare = true;
        this.addScoreToFinalScore(score);
        this.advanceToNextFrame();
        return
      }
      this.addScoreToFinalScore(score);
      this.advanceToNextFrame();
      return
    }
  }
};
<commit_msg>double strike plus a 9 test passed<commit_after>var Game = function() {
  this.finalScore = 0;
  this.bowlsLeftInFrame = 2;
  this.frame = 1;
  this.spare = null;
  this.strike = null;
  this.firstBall = null;
  this.strikeBonuses = 0;
};

Game.prototype.bowl = function(score) {
  if(this.frame > 11) {
    return
  }

  if(this.isSpareInTenthFrame(score)) {
    this.spare = true;
    this.advanceToNextFrame();
    this.bowlsLeftInFrame = 1;
    this.addScoreToFinalScore(score);
    return
  }

  if(this.isEleventhFrame() && this.bowlsLeftInFrame > 0) {
    if(this.spare === true) {
      this.addScoreToFinalScore(score);
      this.bowlsLeftInFrame -= 1;

      if(this.strike === true) { 
        this.addScoreToFinalScore(score);
      }
    }

    if(this.strike === true) {
      if(this.isFirstBall()) {
        this.finalScore += (score * 2);
        this.advanceToNextBall();
        return
      }

      if(this.isSecondBall()) {
        this.finalScore += (score * 2);
        this.advanceToNextFrame();
        return
      }
    }
  }

  if(this.isNotEleventhFrame()) {
    
    if(this.isFirstBall()) {
      if(score === 10 && this.strike === true) {
        this.finalScore += this.strikeBonuses; //20
        this.addScoreToFinalScore(score); //30
        this.advanceToNextFrame();
        return
      }

      if(score === 10 && this.strike != true) {
        this.finalScore += this.strikeBonuses; //0
        this.strikeBonuses = 0;
        this.strike = true;
        this.addScoreToFinalScore(score); //10
        this.strikeBonuses = score;  //strikeBonuses = 10
        this.advanceToNextFrame();
        return
      }

      if(score != 10 && this.strike === true) {
        this.addScoreToFinalScore(score); //39
        this.strikeBonuses = score; //9
        this.finalScore += this.strikeBonuses; //48
        this.strike = null;
        this.advanceToNextBall();
        return
      }

      if(this.spare === true) {
        this.finalScore += (score + this.firstBall);
        this.spare = null;
        this.advanceToNextBall();
        return
      } else {
        this.firstBall = score;
        this.addScoreToFinalScore(score);
        this.advanceToNextBall();
        return
      }
    }

    if(this.isSecondBall()) {
      if(this.strike === true) {
        this.finalScore += (score * 2);
        this.strike = null;
        this.advanceToNextFrame();
        return
      }

      if(this.firstBall + score === 10) {
        this.spare = true;
        this.addScoreToFinalScore(score);
        this.advanceToNextFrame();
        return
      }
      this.finalScore += this.strikeBonuses; //57
      this.strikeBonuses = 0;
      this.addScoreToFinalScore(score);
      this.advanceToNextFrame();
      return
    }
  }
};

{'fraction_non_alphanumeric': 0.13501423342822286, 'fraction_numerical': 0.011590077267181781, 'mean_word_length': 2.0159411404046597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7604775', 'n_tokens_mistral': 1721, 'n_tokens_neox': 1617, 'n_words': 256}