tests/lib/ludorum.js
/** A Pig match finishes when one player reaches or passes the goal score. The result for each 
	player is the difference between its score and its opponent's score.
	*/
A Pig match finishes when one player reaches or passes the goal score. The result for each
player is the difference between its score and its opponent's score.
A Pig match finishes when one player reaches or passes the goal score . The result for each player is the difference between its score and its opponent ' s score .
function result() {
		var score0 = this.__scores__[this.players[0]],
			score1 = this.__scores__[this.players[1]];
		if (score0 >= this.goal || score1 >= this.goal) {
			var r = {};
			r[this.players[0]] = Math.min(this.goal, score0) - Math.min(this.goal, score1);
			r[this.players[1]] = -r[this.players[0]];
			return r;
		}
	}
function result ( ) { var score0 = this . __scores__ [ this . players [ 0 ] ] , score1 = this . __scores__ [ this . players [ 1 ] ] ; if ( score0 >= this . goal || score1 >= this . goal ) { var r = { } ; r [ this . players [ 0 ] ] = Math . min ( this . goal , score0 ) - Math . min ( this . goal , score1 ) ; r [ this . players [ 1 ] ] = - r [ this . players [ 0 ] ] ; return r ; } }
A Pig match finishes when one player reaches or passes the goal score.
A Pig match finishes when one player reaches or passes the goal score .