src/games/OddsAndEvens.js
/** The player matching the parity of the moves sum earns a point.
	*/
The player matching the parity of the moves sum earns a point.
The player matching the parity of the moves sum earns a point .
function next(moves, haps, update) {
		raiseIf(typeof moves.Evens !== 'number' || typeof moves.Odds !== 'number',
			"Invalid moves ", moves, "!");
		raiseIf(haps, "Haps are not required (given ", haps, ")!");
		var parity = (moves.Evens + moves.Odds) % 2 === 0,
			points = {
				Evens: this.points.Evens + (parity ? 1 : 0),
				Odds: this.points.Odds + (parity ? 0 : 1)
			};
		if (update) {
			this.turns--;
			this.points = points;
			return this;
		} else {
			return new this.constructor(this.turns - 1, points);
		}
	}
function next ( moves , haps , update ) { raiseIf ( typeof moves . Evens !== 'number' || typeof moves . Odds !== 'number' , "Invalid moves " , moves , "!" ) ; raiseIf ( haps , "Haps are not required (given " , haps , ")!" ) ; var parity = ( moves . Evens + moves . Odds ) % 2 === 0 , points = { Evens : this . points . Evens + ( parity ? 1 : 0 ) , Odds : this . points . Odds + ( parity ? 0 : 1 ) } ; if ( update ) { this . turns -- ; this . points = points ; return this ; } else { return new this . constructor ( this . turns - 1 , points ) ; } }
The player matching the parity of the moves sum earns a point.
The player matching the parity of the moves sum earns a point .