File Coverage

blib/lib/Games/Tournament/Swiss/Procedure.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Games::Tournament::Swiss::Procedure;
2             $Games::Tournament::Swiss::Procedure::VERSION = '0.20';
3             # Last Edit: 2011 2月 27, 21時17分29秒
4             # $Id: $
5              
6 26     26   126 use warnings;
  26         39  
  26         702  
7 26     26   120 use strict;
  26         38  
  26         655  
8              
9             # use Games::Tournament::Swiss::Config;
10 26     26   122 use base $Games::Tournament::Swiss::Config::algorithm;
  26         39  
  26         14435  
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<< >>
101              
102             =head1 BUGS
103              
104             Please report any bugs or feature requests to
105             C, or through the web interface at
106             L.
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
123              
124             =item * CPAN Ratings
125              
126             L
127              
128             =item * RT: CPAN's request tracker
129              
130             L
131              
132             =item * Search CPAN
133              
134             L
135              
136             =back
137              
138             =head1 ACKNOWLEDGEMENTS
139              
140             See L for the FIDE's Swiss rules.
141              
142             See L for John Chew's perl script tsh and some competition systems principles.
143              
144             See L 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             1; # End of Games::Tournament::Swiss::Procedure
156              
157             # vim: set ts=8 sts=4 sw=4 noet: