Games::Tournament - Contestant Pairing
$tourney = Games::Tournament->new(\@entrants);
next if $capablanca->met($alekhine)
$round = $tourney->meeting($member1, [$member2, $member3]);
In a tournament, there are contestants, and matches over rounds between the contestants, in which they are differentiated by role. TODO firstround and roles.
Games::Tournament->new( rounds => 2, entrants => [ $a, $b, $c ] )
Creates a competition for entrants, over a number of rounds. entrants is a list of player objects. Enters (see enter method) each of the entrants in the tournament. (But why is the entrants arg being deleted?)
Enters a Games::Tournament::Contestant player object with a rating, title id, and name in the entrants of the tournament. Die if no name or id. We are authoritarians. Warn if no rating defined. No check for duplicate ids. Set this round as their first round, unless they already entered in an earlier round (But did they play in that round?) Set their absent accessor if they are in absentees.
@rankings = $tourney->rank(@players)
Ranks a list of Games::Tournament::Contestant player objects by score, rating, title and name if they all have a score, otherwise ranks them by rating, title and name. This is the same ordering that is used to determine pairing numbers in a swiss tournament.
@reverseRankings = $tourney->reverseRank(@players)
Ranks in reverse order a list of Games::Tournament::Contestant player objects by score, rating, title and name if they all have a score, otherwise reverseRanks them by rating, title and name.
Returns a contestant whose name is $name, the first entrant with a name with stringwise equality. So beware same-named contestants.
Returns the contestant whose id is $id. Ids are grepped for stringwise equality.
Returns the roles of the contestants in the individual $games in @games, eg qw/Black White/, qw/Home Away/, these being all the same (ie no typos), or dies.
@rounds = $tourney->met($deepblue, @grandmasters)
next if $tourney->met($deepblue, $capablanca)
In list context, returns an array of the rounds in which $deepblue met the corresponding member of @grandmasters (and of the empty string '' if they haven't met.) In scalar context, returns the number of grandmasters met. Don't forget to collect scorecards in the appropriate games first! (Assumes players do not meet more than once!) This is NOT the same as Games::Tournament::Contestant::met! See also Games;:Tournament::Swiss::whoPlayedWho.
@unfinished = $tourney->unmarkedCards(@games)
Returns an array of the games which have no or a wrong result. The result accessor should be an anonymous hash with roles, or 'Bye' as keys and either 'Win' & 'Loss', 'Loss' & 'Win' or 'Draw' & 'Draw', or 'Bye', as values.
$games = $tourney->dupes(@grandmasters)
Returns an anonymous array, of the games in which @grandmasters have met. Don't forget to collect scorecards in the appropriate games first! (Assumes players do not meet more than once!)
@scores = $tourney->updateScores;
Updates entrants' scores for the present (previous) round, using $tourney's play (ie games played) field. Returns an array of the scores in order of the player ids (not at the moment, it doesn't), dying on those entrants who don't have a result for the round. Be careful. Garbage in, garbage out. What is the present round?
( $myrole, $yourrole ) = randomRole;
This returns the 2 roles, @Games::Tournament::roles in a random order.
Gets the games played, keyed on round and id of player. Also sets, but you don't want to do that.
Gets/sets the entrants as an anonymous array of player objects. Users may rely on the original order being maintained in web app cookies.
Gets/sets the absentees as an anonymous array of player objects. These players won't be included in the brackets of players who are to be paired.
Gets/sets the round number of a round near you. The default round number is 0. That is, the 'round' before round 1. The question is when one round becomes the next round.
Gets/sets the number of rounds in the tournament.
$size = 'Maxi' if $tourney->size > 2**$tourney->rounds
Gets the number of entrants
$tourney->idNameCheck # WARNING: 13301616 and 13300849 both, Petrosian, Tigran
Dies if 2 entrants have the same id, warns if they have the same name.
$tourney->idCheck # Petrosian, Tigran, and Tigran Petrosian both 13301616
Dies if 2 entrants have the same id
Warn if 2 entrants have the same name
float($lowest) if $self->odd(@group)
Tests whether the number of players in @group is odd or not.
Discards the logged messages for the passed procedures.
Returns the messages logged for the passed procedures, or all logged procedures if no procedures are passed, as a hash keyed on the procedures. If no messages were logged, because the procedures were not loggedProcedures, no messages will be returned.
Returns the new messages logged for the passed procedures since they were last tailed, as a hash keyed on the procedures. If no messages were logged, because the procedures were not loggedProcedures, no messages will be returned.
$pairing->log('x=p=1, no more x increases in Bracket 4 (2).')
Saves the message in a log iff this procedure is logged.
$group->loggedProcedures(qw/C10 C11 C12/)
$group->loggedProcedures(qw/C5 C6PAIRS C7 C8/)
Adds messages generated in the procedures named in the argument list to a reportable log. Without an argument returns the logged procedures as an array.
Adds messages generated in all the procedures to a reportable log
$group->disloggedProcedures(qw/C6PAIRS C7 C8/)
Stops messages generated in the procedures named in the argument list being added to a reportable log. Without an argument stops logging of all procedures.
Dr Bean, <drbean, followed by the at mark (@), cpan, then a dot, and finally, org>
<drbean, followed by the at mark (@), cpan, then a dot, and finally, org>
Please report any bugs or feature requests to bug-games-tournament-swiss at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Tournament. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-games-tournament-swiss at rt.cpan.org
You can find documentation for this module with the perldoc command.
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
RT: CPAN's request tracker
Copyright 2006 Dr Bean, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Games::Tournament::Swiss, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.