<commit_before>function Game() {
	this.rollsArray = [];
	this.secondRoll = false;
	this.currentScore = [];
	this.halfStrike = false;
};

Game.prototype.rollBall = function(pinsDown) {
	if (pinsDown === 10) {
		this.rollsArray.push(pinsDown, 0);
	} else {
		this.rollsArray.push(pinsDown);
	}
	console.log(this.rollsArray);
	this.spare();
	console.log(this.spare());
	this.isSecondRoll();
	this.score();
	return pinsDown;
};

Game.prototype.isSecondRoll = function() {
	if (this.rollsArray.length % 2 === 0) {
		return this.secondRoll = true;
	} else {
		return this.secondRoll = false;
	}
};

Game.prototype.score = function() {
	
	if (this.secondRoll) {
		return this.currentScore.push(this.rollsArray.reduce(function(a,b){return a+b;}));
	} else {
		return this.currentScore;
	}
};

Game.prototype.spare = function() {
	if (this.rollsArray.length % 2 === 0 && this.rollsArray.slice(-2).reduce(function(a,b){return a+b;}) === 10) {
		return this.halfStrike = true;
	} else {
		return this.halfStrike = false;
	}<commit_msg>spare<commit_after>function Game() {
	this.rollsArray = [];
	this.secondRoll = false;
	this.currentScore = [];
	this.halfStrike = false;
	this.bonus = 0;
};

Game.prototype.rollBall = function(pinsDown) {
	if (pinsDown === 10) {
			this.rollsArray.push(pinsDown, 0);
	} else if (this.halfStrike) {
			this.currentScore.splice(-1, 1, parseInt(this.currentScore.slice(-1), 10) + pinsDown);
			this.bonus += pinsDown;
			this.rollsArray.push(pinsDown);
	} else {
			this.rollsArray.push(pinsDown);
	}
	console.log(this.rollsArray);
	console.log(this.spare());
	console.log(this.currentScore);

	this.spare();
	this.isSecondRoll();
	this.score();
	return pinsDown;
};

Game.prototype.isSecondRoll = function() {
	if (this.rollsArray.length % 2 === 0) {
		return this.secondRoll = true;
	} else {
		return this.secondRoll = false;
	}
};

Game.prototype.score = function() {

	if (this.secondRoll) {
		return this.currentScore.push(this.bonus + this.rollsArray.reduce(function(a,b){return a+b;}));
	} else {
		return this.currentScore;
	}
};

Game.prototype.spare = function() {
	if (this.rollsArray.length % 2 === 0 && this.rollsArray.slice(-2).reduce(function(a,b){return a+b;}) === 10 && this.rollsArray.slice(-1) != 0) {
		return this.halfStrike = true;
	} else {
		return this.halfStrike = false;
	}
{'fraction_non_alphanumeric': 0.17657192075796727, 'fraction_numerical': 0.012058570198105082, 'mean_word_length': 4.243792325056433, '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': '6556802', 'n_tokens_mistral': 929, 'n_tokens_neox': 864, 'n_words': 143}