The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

VERSION

Version 0.01

SYNOPSIS

    $action = 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

    $action = 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");

'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 should be instances of the Games::Tournament::Contestant::Swiss class but perhaps some other class that overloads both string quoting with a 'name' method and arithmetical operations with an 'index' method will do. '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 NoShow and byes? NoShow has no special form. 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).

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

round

 $action->round

Returns the round in which the match is taking place.

contestants

        $action->contestants

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

result

        $action->result

Gets/sets the results of the match.

float

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

Gets/sets whether the player was floated 'Up', 'Down', or 'Not' floated.

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.