| 1 | package Games::Tournament::Swiss::Procedure; | ||
| 2 | 32 | $Games::Tournament::Swiss::Procedure::VERSION = '0.21'; | |
| 3 | # Last Edit: 2011 2月 27, 21時17分29秒 | ||
| 4 | # $Id: $ | ||
| 5 | |||
| 6 | 32 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 32 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | # use Games::Tournament::Swiss::Config; | ||
| 10 | 32 | ▶ | use base $Games::Tournament::Swiss::Config::algorithm; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | |||
| 13 | =head1 NAME | ||
| 14 | |||
| 15 | Games::Tournament::Swiss::Procedure - A wrapper around a swiss pairing algorithm | ||
| 16 | |||
| 17 | =cut | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | my $pairing = $tourney->pairing( \@brackets ); | ||
| 22 | require Games::Tournament::Swiss::Procedure; | ||
| 23 | $pairing->matchPlayers; | ||
| 24 | @nextGame = map { @{ $_ } } @{$pairing->matches}; | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | A number of different swiss pairing algorithms exist. This is a wrapper allowing you to swap in a algorithm in a module via a configuration file. | ||
| 29 | |||
| 30 | =head1 REQUIREMENTS | ||
| 31 | |||
| 32 | The module that you wrap needs a 'new' constructor and 'matchPlayers' and 'matches' methods. | ||
| 33 | |||
| 34 | =head1 METHODS | ||
| 35 | |||
| 36 | =head2 new | ||
| 37 | |||
| 38 | In Some/Arbitrary/Swiss/Algorithm.pm: | ||
| 39 | |||
| 40 | # a possible constructor | ||
| 41 | |||
| 42 | $algorithm = Some::Arbitrary::Swiss::Algorithm->new( | ||
| 43 | round => $round, | ||
| 44 | brackets => $brackets, | ||
| 45 | incompatibles => $tourney->incompatibles, | ||
| 46 | byes => $args{byes}, | ||
| 47 | matches => [] ) | ||
| 48 | |||
| 49 | Called in the Class::Tournament::Swiss method, 'pairing'. | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | # sub new { my $self = shift; $self->SUPER::new(@_); } | ||
| 54 | |||
| 55 | =head2 matchPlayers | ||
| 56 | |||
| 57 | $pairing->matchPlayers; | ||
| 58 | |||
| 59 | Run the algorithm adding matches to $pairing->matches. A setter. | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | # sub matchPlayers { my $self = shift; $self->SUPER::matchPlayers(@_); } | ||
| 64 | |||
| 65 | |||
| 66 | =head2 matches | ||
| 67 | |||
| 68 | %matches = map { $n++ => $_ } @{$pairing->matches} | ||
| 69 | |||
| 70 | Gets/sets the matches which the algorithm made. Returns an anonymous array of anonymous arrays of Games::Tournament::Card objects representing the matches in the individual brackets. | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | # sub matches { my $self = shift; $self->SUPER::matches(@_); } | ||
| 75 | |||
| 76 | |||
| 77 | =head2 incompatibles | ||
| 78 | |||
| 79 | $pairing->incompatibles | ||
| 80 | |||
| 81 | You may want to have an incompatibles accessor, getting/setting an anonymous hash, keyed on the pairing numbers of the two opponents, of a previous round in which individual pairs of @grandmasters, if any, met. Such a hash is calculated by Games::Tournament::Swiss::incompatibles. B1 | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | # sub incompatibles { } | ||
| 86 | |||
| 87 | |||
| 88 | =head2 byes | ||
| 89 | |||
| 90 | $group->byes | ||
| 91 | |||
| 92 | You may want to have a byes accessor, getting/setting a anonymous hash, keyed on pairing numbers of players, of a previous round in which these players had a bye. Such a hash is calculated by Games::Tournament::Swiss::byes. B1 | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | # sub byes { } | ||
| 97 | |||
| 98 | =head1 AUTHOR | ||
| 99 | |||
| 100 | Dr Bean, C<< <drbean, followed by the at mark (@), cpan, then a dot, and finally, org> >> | ||
| 101 | |||
| 102 | =head1 BUGS | ||
| 103 | |||
| 104 | Please report any bugs or feature requests to | ||
| 105 | C<bug-games-tournament-swiss at rt.cpan.org>, or through the web interface at | ||
| 106 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Tournament-Swiss>. | ||
| 107 | I will be notified, and then you'll automatically be notified of progress on | ||
| 108 | your bug as I make changes. | ||
| 109 | |||
| 110 | =head1 SUPPORT | ||
| 111 | |||
| 112 | You can find documentation for this module with the perldoc command. | ||
| 113 | |||
| 114 | perldoc Games::Tournament::Swiss | ||
| 115 | |||
| 116 | You can also look for information at: | ||
| 117 | |||
| 118 | =over 4 | ||
| 119 | |||
| 120 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 121 | |||
| 122 | L<http://annocpan.org/dist/Games-Tournament-Swiss> | ||
| 123 | |||
| 124 | =item * CPAN Ratings | ||
| 125 | |||
| 126 | L<http://cpanratings.perl.org/d/Games-Tournament-Swiss> | ||
| 127 | |||
| 128 | =item * RT: CPAN's request tracker | ||
| 129 | |||
| 130 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Games-Tournament-Swiss> | ||
| 131 | |||
| 132 | =item * Search CPAN | ||
| 133 | |||
| 134 | L<http://search.cpan.org/dist/Games-Tournament-Swiss> | ||
| 135 | |||
| 136 | =back | ||
| 137 | |||
| 138 | =head1 ACKNOWLEDGEMENTS | ||
| 139 | |||
| 140 | See L<http://www.fide.com/official/handbook.asp?level=C04> for the FIDE's Swiss rules. | ||
| 141 | |||
| 142 | See L<http://www.math.utoronto.ca/jjchew/software/tsh/doc/all.html#_pairing_> for John Chew's perl script tsh and some competition systems principles. | ||
| 143 | |||
| 144 | See L<http://search.cpan.org/dist/Algorithm-Pair-Swiss> for a swiss pairing algorithm. | ||
| 145 | |||
| 146 | =head1 COPYRIGHT & LICENSE | ||
| 147 | |||
| 148 | Copyright 2006 Dr Bean, all rights reserved. | ||
| 149 | |||
| 150 | This program is free software; you can redistribute it and/or modify it | ||
| 151 | under the same terms as Perl itself. | ||
| 152 | |||
| 153 | =cut | ||
| 154 | |||
| 155 | 32 | 1; # End of Games::Tournament::Swiss::Procedure | |
| 156 | |||
| 157 | # vim: set ts=8 sts=4 sw=4 noet: | ||