Games::Tournament::Card - A record of the results of a match


    $game = Games::Tournament:Card->new(round => 1, contestants => {Black => $knicks, White => $deepblue}, result => { Black => 'Win', White => 'Loss' });


In a tournament, matches take place in rounds between contestants, who are maybe floated, and who have roles, and there is a result for these matches, which can be written on a card.



    $game = Games::Tournament:Card->new(
            round => 1,
            contestants => {Black => $knicks, White => $deepblue},
            result => { Black => 'Win', White => 'Loss' },
            floats => { Black => 'Up', White => 'Down' }, or 
            floats => { Black => 'Not', White => 'Not' }
    $bye = Games::Tournament:Card->new(
            round => 1,
            contestants => {Bye => $player},
            result => "Bye"
            floats => 'Down' );

'contestants' is a hash ref of player objects, keyed on Black and White, or Home and Away, or some other role distinction that needs to be balanced over the tournament. The players are probably instances of the Games::Tournament::Contestant::Swiss class. 'result' is a hash reference, keyed on the same keys as contestants, containing the results of the match. 'floats' is a hash of which role was floated up and which down. The default is neither contestant was floated, and 'Down' for a Bye. A4. What are the fields in Forfeits and byes? Forfeit and Tardy have no special form, other than { White => 'Forfeit', Black => 'Tardy' }. Bye is { Bye => $player }. TODO Perhaps the fields should be Winner and Loser, and Down and Up?



Fleshes out a partial statement of the result. From an abbreviated match result (eg, { Black => 'Win' }), works out a canonical representation (eg, { Black => 'Win', White => 'Loss' }). A bye result is represented as { Bye => 'Bye' }.



Returns the result for $player from $game, eg 'Win', 'Loss' or 'Draw'. TODO Should return 0,0.5,1 in numerical context.



Returns an array of the players from $game, eg ($alekhine, $yourNewNicks) in ROLES order.



A predicate to perform a test to see if a player is a contestant in $game. Because different objects may refer to the same player when copied by value, use id to decide.



Returns the opponent of $player from $game. If $player has a Bye, return a Games::Tournament::Contestant::Swiss object with name 'Bye', and id 'Bye'.



Returns the role for $player from $game, eg 'White', 'Banker' or 'Away'.



Returns the float for $player in $game, eg 'Up', 'Down' or 'Not'.


    Games::Tournament::Card->opponentRole( $role )

Returns the role of the opponent of the player in the given role. Class method.



Returns the round in which the match is taking place.



Gets/sets the participants as an anonymous array of player objects.



Gets/sets the results of the match.



Tests whether the players have equal scores, returning 1 or ''. If scores were not equal, they are (should be) floating.



Returns the role of the player with the higher score, returning '', if scores are equal.



Gets/sets the floats of the match. Probably $game->float($player, 'Up') is used however, instead.



Gets/sets whether the player was floated 'Up', 'Down', or 'Not' floated. $player->floats is not changed. This takes place in $tourney->collectCards. TODO what if $player is 'Bye'?



Returns whether the card is for a bye rather than a game between two oppponents.


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


Please report any bugs or feature requests to bug-games-tournament-match at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


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

    perldoc Games::Tournament::Card

You can also look for information at:



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.