« blib/lib/Games/Tournament/Swiss/Bracket.pm
↑ Summary
blib/lib/Games/Tournament/Contestant/Swiss/Preference.pm »
| 1 | package Games::Tournament::Card; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 33 | $Games::Tournament::Card::VERSION = '0.21'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | # Last Edit: 2011 2月 27, 21時34分46秒 | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # $Id: $ | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 33 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 33 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 33 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 33 | ▶ | use List::Util qw/min reduce sum first/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 33 | ▶ | use List::MoreUtils qw/any all/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 33 | ▶ | use Scalar::Util qw/looks_like_number/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 33 | ▶ | use constant ROLES => @Games::Tournament::Swiss::Config::roles? | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | @Games::Tournament::Swiss::Config::roles: | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 33 | Games::Tournament::Swiss::Config->roles; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | Games::Tournament::Card - A record of the results of a match | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | $game = Games::Tournament:Card->new(round => 1, contestants => {Black => $knicks, White => $deepblue}, result => { Black => 'Win', White => 'Loss' }); | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 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. | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | $game = Games::Tournament:Card->new( | ||||||||||||||||||||||||||||||||||||||||||
| 37 | round => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | contestants => {Black => $knicks, White => $deepblue}, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | result => { Black => 'Win', White => 'Loss' }, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | floats => { Black => 'Up', White => 'Down' }, or | ||||||||||||||||||||||||||||||||||||||||||
| 41 | floats => { Black => 'Not', White => 'Not' } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 43 | $bye = Games::Tournament:Card->new( | ||||||||||||||||||||||||||||||||||||||||||
| 44 | round => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | contestants => {Bye => $player}, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | result => "Bye" | ||||||||||||||||||||||||||||||||||||||||||
| 47 | floats => 'Down' ); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | '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? | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 618 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 618 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 618 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 618 | return bless \%args, $self; | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | =head2 canonize | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | $game->canonize | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 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' }. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 22 | ▶ | sub canonize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonize: called CC=12 SCAR=26.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 22 | my $round = $self->round; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 22 | my $contestants = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 22 | my $result = $self->result; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 22 | my %result; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 22 | my %roles = map { $contestants->{$_}->{id} => $_ } keys %$contestants; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 22 | ▶ | warn | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
keys %roles == 2 or grep /bye/i, values %roles
MC/DC0%0/2
keys %roles == 2 or grep /bye/i, values %roles
keys %roles == 2
grep /bye/i, values %roles
Truth table66%2/3
A or B
A= keys %roles == 2B= grep /bye/i, values %roles
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | "Incomplete match of @{[values( %roles )]} players @{[map {$_->id} values %$contestants]} in round $round.\n" | |||||||||||||||||||||||||||||||||||||||||
| 77 | unless keys %roles == 2 | ||||||||||||||||||||||||||||||||||||||||||
| 78 | or grep m/bye/i, values %roles; | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 22 | ROLE: foreach my $contestant ( values %$contestants ) { | |||||||||||||||||||||||||||||||||||||||||
| 80 | 42 | my $role = $roles{ $contestant->{id} }; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 42 | ▶ | if ( $role eq 'Bye' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 2 | $result{$role} = $result->{$role} = 'Bye'; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | elsif ( exists $result->{$role} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 20 | ▶ | if ( $result->{$role} =~ m/^(?:Win|Loss|Draw|Forfeit)$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 20 | $result{$role} = $result->{$role}; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | warn | |||||||||||||||||||||||||||||||||||||||||
| 90 | "$result->{$role} result for player $contestant->{id} in round $round"; | ||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 20 | next ROLE; | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | elsif ( values %$contestants != 1 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 95 | my @opponents = | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 20 | grep { $contestant->id ne $_->id } values %$contestants; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 20 | my $opponent = $opponents[0]; | |||||||||||||||||||||||||||||||||||||||||
| 98 | 20 | my $other = $roles{ $opponent->id }; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 20 | ▶ | if ( exists $result->{$other} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | $result{$role} = 'Loss' | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 20 | ▶ | if $result->{$other} =~ m/^Win$/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | $result{$role} = 'Win' | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 20 | ▶ | if $result->{$other} =~ m/^Loss$/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | $result{$role} = 'Draw' | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 20 | ▶ | if $result->{$other} =~ m/^Draw$/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | warn | |||||||||||||||||||||||||||||||||||||||||
| 109 | "$result->{$role}, $result->{$other} result for player $contestant->{id} and opponent $opponent->{id} in round $round"; | ||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | die "Not a Bye, but no result or no partner"; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 22 | $self->result( \%result ); | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | =head2 myResult | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | $game->myResult($player) | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | Returns the result for $player from $game, eg 'Win', 'Loss' or 'Draw'. | ||||||||||||||||||||||||||||||||||||||||||
| 125 | TODO Should return 0,0.5,1 in numerical context. | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | sub myResult { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
myResult: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $contestant = shift; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->canonize; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $contestants = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $result = $self->result; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my %result; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my %roles = map { $contestants->{$_}->id => $_ } keys %$contestants; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $role = $roles{ $contestant->id }; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return $result->{$role}; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | =head2 myPlayers | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | $game->myPlayers | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | Returns an array of the players from $game, eg ($alekhine, $yourNewNicks) in ROLES order. | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 11771 | ▶ | sub myPlayers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
myPlayers: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 11771 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 11771 | my $contestants = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 11771 | my @players; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 11771 | for my $role ( ROLES ) { | |||||||||||||||||||||||||||||||||||||||||
| 155 | 23542 | ▶ | push @players, $contestants->{$role} if exists $contestants->{$role}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 11771 | ▶ | push @players, $contestants->{Bye} if exists $contestants->{Bye}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 11771 | return @players; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | =head2 hasPlayer | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | $game->hasPlayer($player) | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 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. | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 5665 | ▶ | sub hasPlayer { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hasPlayer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 5665 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 5665 | my $player = shift; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 5665 | my @contestants = $self->myPlayers; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 5665 | ▶ | any { $player->id eq $_->id } @contestants; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | =head2 myOpponent | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | $game->myOpponent($player) | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 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'. | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub myOpponent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
myOpponent: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $contestant = shift; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $id = $contestant->id; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $contestants = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my @contestants = values %$contestants; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my %dupes; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | for my $contestant ( @contestants ) | |||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | die "Player $contestant isn't a contestant" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$contestant and $contestant->isa("Games::Tournament::Contestant::Swiss")
MC/DC0%0/2
$contestant and $contestant->isa("Games::Tournament::Contestant::Swiss")
$contestant
$contestant->isa("Games::Tournament::Contestant::Swiss")
Truth table0%0/3
A and B
A= $contestantB= $contestant->isa("Games::Tournament::Contestant::Swiss")
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | unless $contestant and | ||||||||||||||||||||||||||||||||||||||||||
| 197 | $contestant->isa('Games::Tournament::Contestant::Swiss'); | ||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my @dupes = grep { $dupes{$_->id}++ } @contestants; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | croak "Players @dupes had more than one role" if @dupes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | my $opponent = first { $id ne $_->id } @contestants; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $opponent = Games::Tournament::Contestant::Swiss->new( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | name => "Bye", id => "Bye") if $self->isBye; | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | return $opponent; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | =head2 myRole | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | $game->myRole($player) | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | Returns the role for $player from $game, eg 'White', 'Banker' or 'Away'. | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 5665 | ▶ | sub myRole { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
myRole: called CC=9 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 5665 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 5665 | my $contestant = shift; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 5665 | my $id = $contestant->id; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 5665 | my $round = $self->round; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 5665 | my $contestants = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 5665 | my @contestants = $self->myPlayers; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 5665 | my $players; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 5665 | $players .= " $_: " . $contestants->{$_}->id for keys %$contestants; | |||||||||||||||||||||||||||||||||||||||||
| 225 | 5665 | ▶ | unless ( $self->hasPlayer($contestant) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | carp "Player $id not in Round $round. Contestants are $players."; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 5665 | my %dupes; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 5665 | for my $contestant ( @contestants ) | |||||||||||||||||||||||||||||||||||||||||
| 231 | { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 11126 | ▶ | die "Player $contestant isn't a contestant" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$contestant and $contestant->isa("Games::Tournament::Contestant::Swiss")
MC/DC0%0/2
$contestant and $contestant->isa("Games::Tournament::Contestant::Swiss")
$contestant
$contestant->isa("Games::Tournament::Contestant::Swiss")
Truth table33%1/3
A and B
A= $contestantB= $contestant->isa("Games::Tournament::Contestant::Swiss")
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | unless $contestant and | ||||||||||||||||||||||||||||||||||||||||||
| 234 | $contestant->isa('Games::Tournament::Contestant::Swiss'); | ||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 5665 | my @dupes = grep { $dupes{$_->id}++ } @contestants; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 5665 | ▶ | croak "Player $id not in Round $round match. Contestants are $players." | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | if @dupes; | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 5665 | my %roleReversal; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 5665 | for my $role ( keys %$contestants ) | |||||||||||||||||||||||||||||||||||||||||
| 241 | { | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 11126 | my $id = $contestants->{$role}->id; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 11126 | $roleReversal{$id} = $role; | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 5665 | my $role = $roleReversal{ $id }; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 5665 | ▶ | carp "No role for player $id in round " . $self->round unless $role; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 5665 | return $role; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | =head2 myFloat | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | $game->myFloat($player) | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | Returns the float for $player in $game, eg 'Up', 'Down' or 'Not'. | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 660 | ▶ | sub myFloat { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
myFloat: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 660 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 261 | 660 | my $contestant = shift; | |||||||||||||||||||||||||||||||||||||||||
| 262 | # $self->canonize; | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 660 | my $float = $self->float($contestant); | |||||||||||||||||||||||||||||||||||||||||
| 264 | 660 | return $float; | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | =head2 opponentRole | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | Games::Tournament::Card->opponentRole( $role ) | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | Returns the role of the opponent of the player in the given role. Class method. | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 5 | ▶ | sub opponentRole { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opponentRole: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 5 | my $role = shift; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 5 | my %otherRole; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 5 | @otherRole{ (ROLES) } = reverse (ROLES); | |||||||||||||||||||||||||||||||||||||||||
| 281 | 5 | return $otherRole{ $role }; | |||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | =head2 round | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | $game->round | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | Returns the round in which the match is taking place. | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 6049 | ▶ | sub round { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
round: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 6049 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 6049 | return $self->{round}; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | =head2 contestants | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | $game->contestants | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | Gets/sets the participants as an anonymous array of player objects. | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 19730 | ▶ | sub contestants { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contestants: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 19730 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 309 | 19730 | my $contestants = shift; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | if ( defined $contestants ) { $self->{contestants} = $contestants; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 19730 | else { return $self->{contestants}; } | |||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | =head2 result | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | $game->result | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | Gets/sets the results of the match. | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 6387 | ▶ | sub result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 6387 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 6387 | my $result = shift; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 6387 | ▶ | if ( defined $result ) { $self->{result} = $result; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 6234 | else { return $self->{result}; } | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | =head2 equalScores | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | $game->equalScores | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | Tests whether the players have equal scores, returning 1 or ''. If scores were not equal, they are (should be) floating. | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 3 | ▶ | sub equalScores { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equalScores: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 3 | my $contestants = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 3 | my @score = map { $contestants->{$_}->score } ROLES; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 3 | ▶ | return unless looks_like_number $score[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 3 | ▶ | return all { $score[0] == $_ } @score; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | =head2 higherScoreRole | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | $game->higherScoreRole | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | Returns the role of the player with the higher score, returning '', if scores are equal. | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 2 | ▶ | sub higherScoreRole { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
higherScoreRole: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 2 | my $contestant = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 2 | my @score = map { $contestant->{$_}->score } ROLES; | |||||||||||||||||||||||||||||||||||||||||
| 360 | 2 | ▶ | return (ROLES)[0] if $score[0] > $score[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 1 | ▶ | return (ROLES)[1] if $score[0] < $score[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | =head2 floats | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | $game->floats | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | Gets/sets the floats of the match. Probably $game->float($player, 'Up') is used however, instead. | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | sub floats { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
floats: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $floats = shift; | |||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | if ( defined $floats ) { $self->{floats} = $floats; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | else { return $self->{floats}; } | |||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | =head2 float | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | $card->float($player[,'Up|Down|Not']) | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 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'? | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | 1442 | ▶ | sub float { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
float: called CC=9 SCAR=22.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | 1442 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 392 | 1442 | my $player = shift; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 1442 | ▶ | die "Player is $player ref" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$player and $player->isa("Games::Tournament::Contestant::Swiss")
MC/DC0%0/2
$player and $player->isa("Games::Tournament::Contestant::Swiss")
$player
$player->isa("Games::Tournament::Contestant::Swiss")
Truth table33%1/3
A and B
A= $playerB= $player->isa("Games::Tournament::Contestant::Swiss")
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | unless $player and $player->isa('Games::Tournament::Contestant::Swiss'); | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 1442 | my $role = $self->myRole($player); | |||||||||||||||||||||||||||||||||||||||||
| 396 | 1442 | ▶ | croak "Player " . $player->id . " has $role role in round $self->{round}?" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$role eq "Bye" or $role eq ("White", "Black")[0] or $role eq ("White", "Black")[1]
$role eq "Bye" or $role eq ("White", "Black")[0]
MC/DC0%0/3
$role eq "Bye" or $role eq ("White", "Black")[0] or $role eq ("White", "Black")[1]
$role eq "Bye"
$role eq ("White", "Black")[0]
$role eq ("White", "Black")[1]
Truth table75%3/4
A or B or C
A= $role eq "Bye"B= $role eq ("White", "Black")[0]C= $role eq ("White", "Black")[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | unless $role eq 'Bye' | ||||||||||||||||||||||||||||||||||||||||||
| 398 | or $role eq (ROLES)[0] | ||||||||||||||||||||||||||||||||||||||||||
| 399 | or $role eq (ROLES)[1]; | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 1442 | my $float = shift; | |||||||||||||||||||||||||||||||||||||||||
| 401 | 1442 | ▶ | if ( $role eq 'Bye' ) { return 'Down'; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 539 | elsif ( defined $float ) { $self->{floats}->{$role} = $float; } | |||||||||||||||||||||||||||||||||||||||||
| 403 | 153 | elsif ( $self->{floats}->{$role} ) { return $self->{floats}->{$role}; } | |||||||||||||||||||||||||||||||||||||||||
| 404 | 690 | else { return 'Not'; } | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | =head2 isBye | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | $card->isBye | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | Returns whether the card is for a bye rather than a game between two oppponents. | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 40 | ▶ | sub isBye { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isBye: called CC=5 SCAR=16.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 40 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 417 | 40 | my $contestants = $self->contestants; | |||||||||||||||||||||||||||||||||||||||||
| 418 | 40 | my @status = keys %$contestants; | |||||||||||||||||||||||||||||||||||||||||
| 419 | 40 | ▶ | return 1 if @status == 1 and any { $_ eq 'Bye' } @status; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition66%2/3
@status == 1 and &any(sub {
$_ eq "Bye";
}
, @status)
MC/DC50%1/2
@status == 1 and &any(sub {
$_ eq "Bye";
}
, @status)
@status == 1
&any(sub {
$_ eq "Bye";
}
, @status)
Truth table66%2/3
A and B
A= @status == 1B= &any(sub {
$_ eq "Bye";
}
, @status)
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 32 | ▶ | return 0 if @status == 2 and all { $_ eq (ROLES)[0] or $_ eq (ROLES)[1] } @status; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 2 branches
Condition33%1/3
@status == 2 and &all(sub {
$_ eq ("White", "Black")[0] or $_ eq ("White", "Black")[1];
}
, @status)
MC/DC0%0/2
@status == 2 and &all(sub {
$_ eq ("White", "Black")[0] or $_ eq ("White", "Black")[1];
}
, @status)
@status == 2
&all(sub {
$_ eq ("White", "Black")[0] or $_ eq ("White", "Black")[1];
}
, @status)
Truth table33%1/3
A and B
A= @status == 2B= &all(sub {
$_ eq ("White", "Black")[0] or $_ eq ("White", "Black")[1];
}
, @status)
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | Dr Bean, C<< <drbean, followed by the at mark (@), cpan, then a dot, and finally, org> >> | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | Please report any bugs or feature requests to | ||||||||||||||||||||||||||||||||||||||||||
| 431 | C<bug-games-tournament-match at rt.cpan.org>, or through the web interface at | ||||||||||||||||||||||||||||||||||||||||||
| 432 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Tournament-Card>. | ||||||||||||||||||||||||||||||||||||||||||
| 433 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||||||||||||||||
| 434 | your bug as I make changes. | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | perldoc Games::Tournament::Card | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | L<http://annocpan.org/dist/Games-Tournament-Card> | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | L<http://cpanratings.perl.org/d/Games-Tournament-Card> | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Games-Tournament-Card> | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | L<http://search.cpan.org/dist/Games-Tournament-Card> | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | Copyright 2006 Dr Bean, all rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||
| 471 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 33 | 1; # End of Games::Tournament::Card | |||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | # vim: set ts=8 sts=4 sw=4 noet: | ||||||||||||||||||||||||||||||||||||||||||