tests/lib/ludorum.js
/** `Tournament.run()` plays all the tournament's matches. Since running a 
	match is asynchronous, running a tournament is too. Hence the result is 
	always a future, which will be resolved when all matches have been played.
	*/
`Tournament.run()` plays all the tournament's matches. Since running a
match is asynchronous, running a tournament is too. Hence the result is
always a future, which will be resolved when all matches have been played.
` Tournament . run () ` plays all the tournament ' s matches . Since running a match is asynchronous running a tournament is too . Hence the result is always a future which will be resolved when all matches have been played .
function run() {
		this.onBegin();
		var tournament = this;
		return Future.doWhile(function () {
			return Future.then(tournament.__advance__(), function (match) {
				if (match) {
					tournament.beforeMatch(match);
					return tournament.__runMatch__(match).then(function (match) {
						tournament.account(match);
						tournament.afterMatch(match);
						return match;
					});
				} else {
					return null;
				}
			});
		}).then(this.onEnd.bind(this));
	}
function run ( ) { this . onBegin ( ) ; var tournament = this ; return Future . doWhile ( function ( ) { return Future . then ( tournament . __advance__ ( ) , function ( match ) { if ( match ) { tournament . beforeMatch ( match ) ; return tournament . __runMatch__ ( match ) . then ( function ( match ) { tournament . account ( match ) ; tournament . afterMatch ( match ) ; return match ; } ) ; } else { return null ; } } ) ; } ) . then ( this . onEnd . bind ( this ) ) ; }
`Tournament.run()` plays all the tournament's matches.
` Tournament . run () ` plays all the tournament ' s matches .