The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::Tournament::Swiss::Procedure - A wrapper around a swiss pairing algorithm

SYNOPSIS

 my $pairing = $tourney->pairing( \@brackets );
 require Games::Tournament::Swiss::Procedure;
 $pairing->matchPlayers;
 @nextGame = map { @{ $_ } } @{$pairing->matches};

DESCRIPTION

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.

REQUIREMENTS

The module that you wrap needs a 'new' constructor and 'matchPlayers' and 'matches' methods.

METHODS

new

 In Some/Arbitrary/Swiss/Algorithm.pm:

# a possible constructor

    $algorithm = Some::Arbitrary::Swiss::Algorithm->new(
        round       => $round,
        brackets    => $brackets,
        incompatibles => $tourney->incompatibles,
        byes => $args{byes},
        matches     => [] )

Called in the Class::Tournament::Swiss method, 'pairing'.

matchPlayers

 $pairing->matchPlayers;

Run the algorithm adding matches to $pairing->matches. A setter.

matches

        %matches = map { $n++ => $_ } @{$pairing->matches}

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.

incompatibles

        $pairing->incompatibles

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

byes

        $group->byes

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

AUTHOR

Dr Bean, <drbean, followed by the at mark (@), cpan, then a dot, and finally, org>

BUGS

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-Swiss. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Games::Tournament::Swiss

You can also look for information at:

ACKNOWLEDGEMENTS

See http://www.fide.com/official/handbook.asp?level=C04 for the FIDE's Swiss rules.

See http://www.math.utoronto.ca/jjchew/software/tsh/doc/all.html#_pairing_ for John Chew's perl script tsh and some competition systems principles.

See http://search.cpan.org/dist/Algorithm-Pair-Swiss for a swiss pairing algorithm.

COPYRIGHT & LICENSE

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.