NAME

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

SYNOPSIS

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

DESCRIPTION

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.

METHODS

new

    $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?

canonize

$game->canonize

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' }.

myResult

$game->myResult($player)

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

myPlayers

$game->myPlayers

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

hasPlayer

$game->hasPlayer($player)

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.

myOpponent

$game->myOpponent($player)

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'.

myRole

$game->myRole($player)

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

myFloat

$game->myFloat($player)

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

opponentRole

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

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

round

$game->round

Returns the round in which the match is taking place.

contestants

$game->contestants

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

result

$game->result

Gets/sets the results of the match.

equalScores

$game->equalScores

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

higherScoreRole

$game->higherScoreRole

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

floats

$game->floats

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

float

$card->float($player[,'Up|Down|Not'])

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'?

isBye

$card->isBye

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

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-match at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Tournament-Card. 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::Card

You can also look for information at:

ACKNOWLEDGEMENTS

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.