| 1 | package Games::Tournament::Swiss::Procedure::FIDE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 25 | $Games::Tournament::Swiss::Procedure::FIDE::VERSION = '0.21'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Last Edit: 2016 Jan 01, 13:44:53 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # $Id: /swiss/trunk/lib/Games/Tournament/Swiss/Procedure/FIDE.pm 1657 2007-11-28T09:30:59.935029Z dv $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 25 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 25 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 25 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 25 | ▶ | use List::Util qw/first/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 25 | ▶ | use List::MoreUtils qw/any all notall/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 25 | ▶ | use constant ROLES => @Games::Tournament::Swiss::Config::roles; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 25 | ▶ | use constant FIRSTROUND => $Games::Tournament::Swiss::Config::firstround; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 25 | ▶ | use base qw/Games::Tournament::Swiss/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 25 | ▶ | use Games::Tournament::Contestant::Swiss; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 25 | ▶ | use constant C1 => 'C1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 25 | ▶ | use constant C2 => 'C2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 25 | ▶ | use constant C3 => 'C3'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 25 | ▶ | use constant C4 => 'C4'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 25 | ▶ | use constant C5 => 'C5'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 25 | ▶ | use constant C6PAIRS => 'C6PAIRS'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 25 | ▶ | use constant C6OTHERS => 'C6OTHERS'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 25 | ▶ | use constant C7 => 'C7'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 25 | ▶ | use constant C8 => 'C8'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 25 | ▶ | use constant C9 => 'C9'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 25 | ▶ | use constant C10 => 'C10'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 25 | ▶ | use constant C11 => 'C11'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 25 | ▶ | use constant C12 => 'C12'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 25 | ▶ | use constant C13 => 'C13'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 25 | ▶ | use constant BYE => 'bye'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 25 | ▶ | use constant C14 => 'C14'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 25 | ▶ | use constant FLOAT => "FLOAT"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 25 | ▶ | use constant START => "START"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 25 | ▶ | use constant LAST => "LAST"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 25 | ▶ | use constant ERROR => "ERROR"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 25 | ▶ | use constant MATCH => "MATCH"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 25 | ▶ | use constant NEXT => "NEXT"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 25 | ▶ | use constant PREV => "PREV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | Games::Tournament::Swiss::Procedure::FIDE - FIDE Swiss Rules Based on Rating 04.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | $tourney = Games::Tournament::Swiss->new( rounds => 2, entrants => [ $a, $b, $c ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | %groups = $tourney->formBrackets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | $pairing = $tourney->pairing( \%groups ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | @pairs = $pairing->matchPlayers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | FIDE Swiss Rules C 04.1 Based on Rating describes an algorithm to pair players. The algorithm starts with the highest bracket, and then pairs each bracket in turn. ending with the lowest bracket, floating players up and down to find acceptable matches, but also undoing pairings in higher score groups, if this will help the pairing of lower score groups. This module pairs players on the basis of that algorithm. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | $pairing = Games::Tournament::Swiss::Procedure->new( \@groups ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | Creates a FIDE C 04.1 algorithm object on a reference to a list of scoregroups ordered by score, the group with highest score first, the one with lowest score last. This object has a matches accessor to the games (cards) the algorithm has made, an incompatibles accessor to previous matches ofthe players, a stack of groups previous to this one at this point in the pairing to which we can go back and XXX. This constructor is called in the Games::Tournament::Swiss::pairing method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 49 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 49 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 49 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | return bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | round => $args{round}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | brackets => $args{brackets}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | whoPlayedWho => $args{whoPlayedWho}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | colorClashes => $args{colorClashes}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | badpair => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | byes => $args{byes}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 49 | matches => {}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | previousBracket => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | logged => {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | "Games::Tournament::Swiss::Procedure"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | =head2 matchPlayers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | @pairs = $pairing->matchPlayers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | Run the FIDE C 04.1 algorithm adding matches to $pairing->matches. NOTE: At one point in deveopment of this module, I was passing round the args, rather than storing them in the object, because of problems with storing. What were those problems? What does matchPlayers return? Is it a hash or the matches or what? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 49 | ▶ | sub matchPlayers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
matchPlayers: called CC=9 SCAR=22.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 49 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 49 | my %machine = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | START, [ \&start, NEXT ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | C1, [ \&c1, C2, NEXT, C13, C12, C1 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | C2, [ \&c2, C3 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | C3, [ \&c3, C4 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | C4, [ \&c4, C5 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | C5, [ \&c5, C6PAIRS ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | C6PAIRS, [ \&c6pairs, C6OTHERS, C7, NEXT ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | C6OTHERS, [ \&c6others, NEXT, C1, C2, C10, C13 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | C7, [ \&c7, C6PAIRS, C8, C9, C10, C11 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | C8, [ \&c8, C5, C9, C10 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | C9, [ \&c9, C4, C10 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | C10, [ \&c10, C7, C4, C11 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | C11, [ \&c11, C12, C4, C7 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | C12, [ \&c12, C13, C7, ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | C13, [ \&c13, C14, C7, C1, BYE ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | C14, [ \&c14, NEXT, C4, C13 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | BYE, [ \&bye, LAST, C13 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | NEXT, [ \&next, C1, LAST ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | PREV, [ \&prev, C1, LAST ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | LAST, [ undef, LAST ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ERROR, [ undef, ERROR ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 49 | my $state = START; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 49 | my $oldState = $state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 49 | my %args = %$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 49 | for ( ; ; ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 5623 | my $transitions = $machine{$state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 5623 | ▶ | die "$oldState, $state, $transitions" unless $transitions and ref($transitions) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$transitions and ref $transitions eq "ARRAY"
MC/DC0%0/2
$transitions and ref $transitions eq "ARRAY"
$transitions
ref $transitions eq "ARRAY"
Truth table33%1/3
A and B
A= $transitionsB= ref $transitions eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 5623 | my ( $action, @alterStates ) = @$transitions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 5623 | $oldState = $state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 5623 | ▶ | ( $state, %args ) = $action->( $self, %args ) if $action; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 5623 | ▶ | if ( any { $_ eq $oldState } $self->loggedProcedures ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 142 | my %log = $self->tailLog($oldState); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 142 | ▶ | $self->logreport( $oldState . "," . $log{$oldState} ) if %log; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 5623 | ▶ | if ( $state eq ERROR ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | die | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | qq/Pairing error: $args{msg}. Pairing NOT complete\n/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 5623 | ▶ | if ( $state eq LAST ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 49 | $self->message( $args{msg} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 49 | return $self; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 5574 | ▶ | die "No transition defined from $oldState to $state" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | unless grep m/$state/, @alterStates; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | =head2 message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $pairing->message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | Something about the success or failure of the pairing procedure as far as it concerns the user. This is not a message about the success or failure of the Games::Tournament::Swiss::Procedure::FIDE code as in 'warn', or a logging of the progress of the players in their brackets through the FIDE pairing procedure as in 'log', or a message about a problem coding the FIDE algorithm, as in 'ERROR'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 49 | ▶ | sub message { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
message: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 49 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 49 | my $message = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 49 | ▶ | if ( defined $message ) { $self->{message} .= $message; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | elsif ( $self->{message} ) { return $self->{message}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | =head2 logreport | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | $pairing->logreport('C6: Pairing S1 and S2'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | Accumulates a log in string form, of the progress of the players in their brackets through the FIDE pairing procedure, using the logging methods of Games::Tournament, and returning the log accumulated if no arguments are passed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 143 | ▶ | sub logreport { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
logreport: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 143 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 143 | my $logreport = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 143 | ▶ | if ( defined $logreport ) { $self->{logreport} .= $logreport; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | elsif ( $self->{logreport} ) { return $self->{logreport}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | =head2 start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | $pairing->start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | Start at the start before the first bracket. Go to the next bracket. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 49 | ▶ | sub start { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 49 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 49 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 49 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 49 | ▶ | die "Can't start. Already started." if defined $index; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 49 | $self->thisBracket('START'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 49 | my $round = $self->round; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 49 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 49 | my $banner = "Round $round: "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 49 | for my $bracket ( reverse sort keys %$brackets ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 119 | my $members = $brackets->{$bracket}->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 119 | my $score = $brackets->{$bracket}->score; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 119 | $banner .= "@{[map { $_->pairingNumber } @$members]} ($score), "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 49 | $self->log( $banner ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 49 | return NEXT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | =head2 next | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | $pairing->next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | Pair the next bracket. End if this is the last bracket. Die if we are not pairing any bracket now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 223 | ▶ | sub next { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=7 SCAR=20.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 223 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 223 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 223 | ▶ | die "No bracket being paired" unless defined $index; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 223 | ▶ | return LAST if defined $index and $index eq $self->lastBracket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $index and $index eq $self->lastBracket
MC/DC50%1/2
defined $index and $index eq $self->lastBracket
defined $index
$index eq $self->lastBracket
Truth table66%2/3
A and B
A= defined $indexB= $index eq $self->lastBracket
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 205 | my $next = $self->nextBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 205 | ▶ | die "No next bracket to $index-Bracket" unless defined $next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 205 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 205 | my $nextBracket = $groups->{$next}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 205 | ▶ | die "Next bracket is: $next Bracket?" unless defined $nextBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $nextBracket and $nextBracket->isa("Games::Tournament::Swiss::Bracket")
MC/DC0%0/2
defined $nextBracket and $nextBracket->isa("Games::Tournament::Swiss::Bracket")
defined $nextBracket
$nextBracket->isa("Games::Tournament::Swiss::Bracket")
Truth table33%1/3
A and B
A= defined $nextBracketB= $nextBracket->isa("Games::Tournament::Swiss::Bracket")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | and $nextBracket->isa('Games::Tournament::Swiss::Bracket'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 205 | my $members = $nextBracket->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 205 | my @ids = map {$_->pairingNumber} @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 205 | my $number = $nextBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 205 | $self->thisBracket($next); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 205 | $self->log( "$next-Bracket [$number]: @ids" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 205 | return C1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | =head2 prev | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | $pairing->prev; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | Pair the previous bracket. End if this is the first bracket. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub prev { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prev: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $bracket = $brackets->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | return LAST if defined $index and $index eq $self->firstBracket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $index and $index eq $self->firstBracket
MC/DC0%0/2
defined $index and $index eq $self->firstBracket
defined $index
$index eq $self->firstBracket
Truth table0%0/3
A and B
A= defined $indexB= $index eq $self->firstBracket
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my $prevIndex = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $prevBracket = $brackets->{$prevIndex}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my $members = $prevBracket->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $number = $prevBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $self->thisBracket($prevIndex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my @ids = map {$_->pairingNumber} @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $self->log( "Previous, Bracket $number ($prevIndex): @ids"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | return C1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | =head2 c1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | $pairing->c1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | If the score group contains a player for whom no opponent can be found (B1,B2), and if this player is a downfloater, go to C12 to find another player to downfloat instead. Or if this is the last group, go to C13. Otherwise, downfloat the unpairable player. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 208 | ▶ | sub c1 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c1: called CC=24 SCAR=31.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 208 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 208 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 208 | my $alreadyPlayed = $self->whoPlayedWho; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 208 | my $colorClashes = $self->colorClashes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 208 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 208 | my $group = $groups->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 208 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 208 | my $members = $group->residents; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 208 | my @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 208 | my $nokmessage = 'NOK.'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 208 | ▶ | if ( @$members == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 49 | my $member = $members->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 49 | push @unpairables, $member; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 49 | my $id = $member->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 49 | $nokmessage .= " $id"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 49 | $self->log( $nokmessage . " only member in $index-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 159 | for my $player (@$members) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 591 | my $id = $player->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 591 | my $pairingNumber = $player->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 591 | my $rejections = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 591 | my @candidates = grep { $_ != $player } @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 591 | my @ids = map { $_->id } @candidates; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 591 | foreach my $candidate (@ids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 2090 | ▶ | if ( $alreadyPlayed->{$id}->{$candidate} ) { $rejections++; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 30 | elsif ( $colorClashes->{$id}->{$candidate} ) { $rejections++; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 591 | ▶ | if ( $rejections >= @candidates or @candidates == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$rejections >= @candidates or @candidates == 0
MC/DC50%1/2
$rejections >= @candidates or @candidates == 0
$rejections >= @candidates
@candidates == 0
Truth table66%2/3
A or B
A= $rejections >= @candidatesB= @candidates == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 92 | $nokmessage .= " $pairingNumber"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 92 | push @unpairables, $player; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 159 | ▶ | if (@unpairables) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 72 | my @ids = map { $_->pairingNumber } @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 72 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | "$nokmessage: @ids B1a/B2a incompatible in $number ($index)"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 208 | my @unpairableIds = map {$_->pairingNumber} @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 208 | my ($previousIndex, $previousBracket, $previousMembers, $previousNumber); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 208 | $previousIndex = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 208 | ▶ | $previousBracket = $groups->{$previousIndex} if $previousIndex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 208 | ▶ | $previousMembers = $previousBracket->members if $previousBracket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 208 | ▶ | $previousNumber = $previousBracket->number if $previousBracket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 208 | ▶ | if (@unpairables) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 121 | ▶ | if ( $index eq $self->lastBracket and $index ne $self->firstBracket ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$index eq $self->lastBracket and $index ne $self->firstBracket
MC/DC100%2/2
$index eq $self->lastBracket and $index ne $self->firstBracket
$index eq $self->lastBracket
$index ne $self->firstBracket
Truth table100%3/3
A and B
A= $index eq $self->lastBracketB= $index ne $self->firstBracket
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 89 | $self->log( "@unpairableIds in last bracket, $number ($index)." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 89 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 40 | ▶ | elsif ((grep {$_->floating and $_->floating eq 'Down'} @unpairables) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
grep {$_->floating and $_->floating eq "Down";} @unpairables and $previousIndex and $previousMembers
grep {$_->floating and $_->floating eq "Down";} @unpairables and $previousIndex
$_->floating && $_->floating eq 'Down'
MC/DC0%0/3
grep {$_->floating and $_->floating eq "Down";} @unpairables and $previousIndex and $previousMembers
grep {$_->floating and $_->floating eq "Down";} @unpairables
$previousIndex
$previousMembers
MC/DC50%1/2
$_->floating && $_->floating eq 'Down'
$_->floating
$_->floating eq 'Down'
Truth table50%2/4
A and B and C
A= grep {$_->floating and $_->floating eq "Down";} @unpairablesB= $previousIndexC= $previousMembers
Truth table66%2/3
A && B
A= $_->floatingB= $_->floating eq 'Down'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | and $previousIndex and $previousMembers ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | "@unpairableIds floaters from $previousNumber ($previousIndex)" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return C12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | elsif (defined $self->nextBracket) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 27 | my $next = $self->nextBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 27 | my $nextBracket = $groups->{$next}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 27 | my $nextNumber = $nextBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 27 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | "Floating @unpairableIds down to $next-Bracket [$nextNumber]" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 27 | $group->exit($_) for @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 27 | $_->floating('Down') for @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 27 | $nextBracket->entry($_) for @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 27 | my @originals = map {$_->pairingNumber} @{$group->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 27 | my @new = map {$_->pairingNumber} @{$nextBracket->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 27 | $self->log( "[$number] @originals & [$nextNumber] @new" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 27 | ▶ | if ( @unpairables == @$members ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 25 | my $previous = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 25 | $self->log( "$index-Bracket [$number] dissolved" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 25 | $self->thisBracket($previous); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 25 | $group->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 25 | return NEXT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 2 | else { return C2; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 5 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | "No destination for unpairable @unpairableIds. Go to C2" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 5 | return C2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 87 | $self->log( "B1,2 test: OK, no unpairables" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 87 | return C2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | return ERROR, msg => "Fell through C1 in $number ($index)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | =head2 rejectionTest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | ($message, @unpairables) = $pairing->rejectionTest(@members) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | Returns the unpairable players in a score bracket, if it contains players for whom no opponent can be found (B1,B2). This is useful in C1, but it is also useful in pairing a remainder group, where we want to know the same thing but don't want to take the same action as in C1. It would be convenient to know that the group is unpairable as-is, without going through all the C6,7,8,9,10 computations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 45 | ▶ | sub rejectionTest { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rejectionTest: called CC=10 SCAR=23.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 45 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 45 | my @members = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 45 | my $alreadyPlayed = $self->whoPlayedWho; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 45 | my $colorClashes = $self->colorClashes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 45 | my @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 45 | my $nokmessage = 'NOK.'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 45 | ▶ | if ( @members == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my $member = $members[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | push @unpairables, $member; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my $id = $member->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $nokmessage .= " $id only member"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 45 | for my $player (@members) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 168 | my $id = $player->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 168 | my $rejections = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 168 | my @candidates = grep { $_ != $player } @members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 168 | my @ids = map { $_->id } @candidates;; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 168 | foreach my $candidate ( @ids ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 486 | ▶ | if ( $alreadyPlayed->{$id}->{$candidate} ) { $rejections++; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | elsif ( $colorClashes->{$id}->{$candidate} ) { $rejections++; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 168 | ▶ | if ( $rejections >= @candidates or @candidates == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$rejections >= @candidates or @candidates == 0
MC/DC50%1/2
$rejections >= @candidates or @candidates == 0
$rejections >= @candidates
@candidates == 0
Truth table66%2/3
A or B
A= $rejections >= @candidatesB= @candidates == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 20 | push @unpairables, $player; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 45 | ▶ | if ( @unpairables ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 20 | my @ids = map { $_->pairingNumber } @unpairables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 20 | $nokmessage .= " @ids B1a/B2a incompatible"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 45 | ▶ | if ( @unpairables ) { return $nokmessage, @unpairables; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 25 | else { return "B1,2 test: OK, no unpairables"; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | =head2 c2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | $pairing->c2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | Determine x according to A8. But only if xprime has not been defined for the bracket (remainder group) by C11. See B4 and http://chesschat.org/showthread.php?p=173273#post173273 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 133 | ▶ | sub c2 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c2: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 133 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 133 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 133 | my $this = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 133 | my $group = $groups->{$this}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 133 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 133 | my $x = $group->x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 133 | ▶ | $group->xprime( $group->x ) unless defined $group->xprime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 133 | my $xprime = $group->xprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 133 | $self->log( "x=$xprime" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 133 | return C3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | =head2 c3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | $pairing->c3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | Determine p according to A6. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 133 | ▶ | sub c3 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c3: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 133 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 133 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 133 | my $this = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 133 | my $group = $groups->{$this}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 133 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 133 | my $p = $group->p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 133 | $group->pprime( $group->p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 133 | ▶ | if ( $group->hetero ) { $self->log( "p=$p. Heterogeneous."); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 105 | else { $self->log( "p=$p. Homogeneous."); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 133 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | =head2 c4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | $pairing->c4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | The highest players in S1, the others in S2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 332 | ▶ | sub c4 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c4: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 332 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 332 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 332 | my $group = $groups->{$self->thisBracket}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 332 | my $members = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 332 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 332 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 332 | $group->resetS12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 332 | my $s1 = $group->s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 332 | my $s2 = $group->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 332 | my @s1ids = map {$_->pairingNumber} @$s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 332 | my @s2ids = map {$_->pairingNumber} @$s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 332 | $self->log( "S1: @s1ids & S2: @s2ids" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 332 | ▶ | die "Empty S1 in $index-Bracket ($number) with S2: @s2ids." unless @$s1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 332 | ▶ | die "Empty $index-Bracket ($number) with S1: @s1ids." unless @$s2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 332 | return C5; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | =head2 c5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | $pairing->c5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | Order the players in S1 and S2 according to A2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 566 | ▶ | sub c5 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c5: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 566 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 566 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 566 | my $group = $groups->{ $self->thisBracket }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 566 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 566 | my $members = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 566 | my $x = $group->xprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 566 | my $s1 = $group->s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 566 | my $s2 = $group->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 566 | my @s1 = $self->rank(@$s1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 566 | my @s2 = $self->rank(@$s2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 566 | my @s1ids = map {$_->pairingNumber} @s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 566 | my @s2ids = map {$_->pairingNumber} @s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 566 | $self->log( "ordered: @s1ids\n\t & @s2ids" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 566 | $group->s1( \@s1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 566 | $group->s2( \@s2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 566 | for my $member ( @{ $group->s2 } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | die "$member->{id} was in ${number}th bracket more than once" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 1373 | ▶ | if ( grep { $_->id eq $member->id } @{ $group->s2 } ) > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 566 | $groups->{ $self->thisBracket } = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 566 | $self->brackets($groups); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 566 | return C6PAIRS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | =head2 c6pairs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | Games::Tournament::Swiss::Procedure->c6pairs($group, $matches) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | Pair the pprime players in the top half of the scoregroup in order with their counterparts in the bottom half, and return an array of tentative Games::Tournament::Card matches if B1, B2 and the relaxable B4-6 tests pass. In addition, as part of the B6,5 tests, check none of the UNpaired players in a homogeneous bracket were downfloated in the round before (B5) or the round before that (B6), or that there is not only one UNpaired, previously-downfloated player in a heterogeneous group, special-cased following Bill Gletsos' advice at http://chesschat.org/showpost.php?p=142260&postcount=158. If more than pprime tables are paired, we take the first pprime tables. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 1519 | ▶ | sub c6pairs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c6pairs: called CC=44 SCAR=38.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1519 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1519 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1519 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 1519 | my $group = $groups->{ $index }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 1519 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 1519 | my $pprime = $group->pprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 1519 | my $s1 = $group->s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 1519 | my $s2 = $group->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 1519 | ▶ | return NEXT unless @$s1 and @$s2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$s1 and @$s2
MC/DC0%0/2
@$s1 and @$s2
@$s1
@$s2
Truth table33%1/3
A and B
A= @$s1B= @$s2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 1519 | ▶ | die "More players in S1 than in S2 in $number($index)." if $#$s1 > $#$s2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 1519 | ▶ | die "zero players in S1 or S2 in $number($index)" unless @$s1 and @$s2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$s1 and @$s2
MC/DC0%0/2
@$s1 and @$s2
@$s1
@$s2
Truth table33%1/3
A and B
A= @$s1B= @$s2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 1519 | my $whoPlayedWho = $self->whoPlayedWho; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 1519 | my $colorClashes = $self->colorClashes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 1519 | $group->badpair(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 1519 | my @testee; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 1519 | for my $pos ( 0..$#$s1, $#$s1+1..$#$s2 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 4224 | ▶ | $testee[$pos] = [ $s1->[$pos], $s2->[$pos] ] if $pos <= $#$s1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 4224 | ▶ | $testee[$pos] = [ undef, $s2->[$pos] ] if $pos > $#$s1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 1519 | my ($badpos, @B1passer, @B2passer, @Xpasser, @B56passer, $passer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 1519 | B1: for my $pos (0..$#$s1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 3144 | my @pair = @{$testee[$pos]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 3144 | my $test = not defined $whoPlayedWho->{$pair[0]->id}->{$pair[1]->id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 3144 | ▶ | if ( $test ) { $B1passer[$pos] = \@pair; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 1030 | ▶ | else { $badpos = defined $badpos? $badpos: $pos; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 1519 | ▶ | unless ( (grep { defined $_ } @B1passer) >= $pprime ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 794 | my $pluspos = $badpos+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 794 | $self->log( "B1a: table $pluspos NOK" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 794 | $group->badpair($badpos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 794 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 725 | $badpos = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 725 | ▶ | die "no pairs after B1 test in $number($index)" unless @B1passer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 725 | B2: for my $pos (0..$#$s1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1380 | ▶ | next unless defined $B1passer[$pos]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1380 | my @pair = ( $B1passer[$pos]->[0], $B1passer[$pos]->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 1380 | my $test = not defined $colorClashes->{$pair[0]->id}->{$pair[1]->id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1380 | ▶ | if ( $test ) { $B2passer[$pos] = \@pair; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 9 | ▶ | else { $badpos = defined $badpos? $badpos: $pos; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 725 | ▶ | unless ( (grep { defined $_ } @B2passer) >= $pprime ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 8 | my $pluspos = $badpos+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 8 | $self->log( "B2a: table $pluspos NOK" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 8 | $group->badpair($badpos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 8 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 717 | ▶ | die "no pairs after B2 test in $number($index)" unless @B2passer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 717 | my $x = $group->xprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 717 | my $quota = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 717 | $badpos = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 717 | B4: for my $pos ( 0 .. $#$s1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 1070 | ▶ | next unless defined $B2passer[$pos]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 1070 | my @pair = ( $B2passer[$pos]->[0], $B2passer[$pos]->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 1070 | ▶ | $quota += ( defined $pair[0]->preference->role | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
defined $pair[0]->preference->role && defined $pair[1]->preference->role && $pair[0]->preference->role eq $pair[1]->preference->role
defined $pair[0]->preference->role and defined $pair[1]->preference->role
MC/DC100%3/3
defined $pair[0]->preference->role && defined $pair[1]->preference->role && $pair[0]->preference->role eq $pair[1]->preference->role
defined $pair[0]->preference->role
defined $pair[1]->preference->role
$pair[0]->preference->role eq $pair[1]->preference->role
Truth table100%4/4
A and B && C
A= defined $pair[0]->preference->roleB= defined $pair[1]->preference->roleC= $pair[0]->preference->role eq $pair[1]->preference->role
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | and defined $pair[1]->preference->role | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | and $pair[0]->preference->role eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | $pair[1]->preference->role ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 1070 | ▶ | if ( $quota <= $x ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 626 | ▶ | $group->{xdeduction} = $quota if $group->hetero; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 626 | $Xpasser[$pos] = \@pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 444 | ▶ | else { $badpos = defined $badpos? $badpos: $pos; last B4; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 717 | ▶ | unless ( (grep { defined $_ } @Xpasser) >= $pprime ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 443 | my $pluspos = $badpos+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 443 | $self->log( "B4: x=$x, table $pluspos NOK" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 443 | $group->badpair($badpos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 443 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 274 | ▶ | die "no pairs after B4 test in $number($index)" unless @Xpasser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 274 | $badpos = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | # my @nonpaired = $group->_getNonPaired(@Xpasser); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 274 | my $checkLevels = $self->floatCriteriaInForce( $group->floatCheckWaive ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 274 | my %b65TestResults = $group->_floatCheck( \@Xpasser, $checkLevels ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 274 | $badpos = $b65TestResults{badpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 274 | $self->log( $b65TestResults{message} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 274 | ▶ | if ( defined $badpos ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 80 | my $pluspos = $badpos+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 80 | $group->badpair($badpos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 80 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 194 | $passer = $b65TestResults{passer}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 194 | ▶ | die "no pairs after B65 test in $number($index)" unless @$passer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 194 | for my $pos ( 0 .. $#$passer ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 250 | ▶ | next unless defined $passer->[$pos]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 250 | my @pair = @{$passer->[$pos]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 250 | ▶ | my @score = map { defined $_->score? $_->score: 0 } @pair; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 250 | ▶ | if ( $score[0] > $score[1] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 112 | $pair[0]->floating('Down'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 112 | $pair[1]->floating('Up'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | elsif ( $score[0] == $score[1] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 138 | map { $_->floating('Not') } @pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | $pair[0]->floating('Up'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | $pair[1]->floating('Down'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 194 | my @nonpaired = $group->_getNonPaired(@$passer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 194 | my @paired = grep { defined } @$passer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 194 | ▶ | if ( $#paired >= $pprime ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | my @unrequired = @paired[ $pprime .. $#paired ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | splice @paired, $pprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | unshift @nonpaired, @unrequired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 194 | @nonpaired = map { my $pair=$_; grep { defined } @$pair } @nonpaired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 194 | my @tables = grep { defined $passer->[$_-1] } 1..@$passer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 194 | $self->log( "$index-Bracket ($number) tables @tables paired. OK" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 194 | ▶ | $self->nonpaired(\@nonpaired) if @nonpaired; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 194 | my $allMatches = $self->matches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 194 | ▶ | my ($pairmessage, @matches) = $self->colors( paired => \@paired ) if @paired; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 194 | $self->log( $pairmessage ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 194 | ▶ | if ( $group->hetero and @nonpaired and $group->bigGroupXprime ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$group->hetero and @nonpaired and $group->bigGroupXprime
$group->hetero and @nonpaired
MC/DC66%2/3
$group->hetero and @nonpaired and $group->bigGroupXprime
$group->hetero
@nonpaired
$group->bigGroupXprime
Truth table75%3/4
A and B and C
A= $group->heteroB= @nonpairedC= $group->bigGroupXprime
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 28 | my $bigXprime = $group->bigGroupXprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 28 | my $usedX = $group->{xdeduction}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 28 | my $remainingX = $bigXprime - $usedX; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 28 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | "$usedX of $bigXprime X points used. $remainingX left for remainder group" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 194 | $allMatches->{$index} = \@matches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 194 | ▶ | if (@paired) {if ( @nonpaired ) { return C6OTHERS } else { return NEXT } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | return ERROR, msg => "No paired in C6PAIRS"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | =head2 c6others | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | Games::Tournament::Swiss::Procedure->c6others($group, $matches) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | After pairing players, if there are remaining players in a homogeneous group, float them down to the next score group and continue with C1 (NEXT). In a heterogeneous group, start at C2 with the remaining players, now a homogeneous remainder group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 148 | ▶ | sub c6others { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c6others: called CC=18 SCAR=28.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 148 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 148 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 148 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 148 | my $group = $groups->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 148 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 148 | my $nonpaired = $self->nonpaired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 148 | ▶ | die "Unpaired players are: $nonpaired?" unless defined $nonpaired and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $nonpaired and @$nonpaired
MC/DC0%0/2
defined $nonpaired and @$nonpaired
defined $nonpaired
@$nonpaired
Truth table33%1/3
A and B
A= defined $nonpairedB= @$nonpaired
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | @$nonpaired; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 148 | my $islastBracket = ( $index eq $self->lastBracket ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 148 | ▶ | unless ( $group->hetero and @$nonpaired > 1 or $islastBracket ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$group->hetero and @$nonpaired > 1 or $islastBracket
$group->hetero and @$nonpaired > 1
MC/DC100%3/3
$group->hetero and @$nonpaired > 1 or $islastBracket
$group->hetero
@$nonpaired > 1
$islastBracket
Truth table100%5/5
A and B or C
A= $group->heteroB= @$nonpaired > 1C= $islastBracket
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 60 | my $next = $self->nextBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 60 | my $nextBracket = $groups->{$next}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 60 | my $nextNumber = $nextBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 60 | my @nextMembers = map {$_->pairingNumber} @{$nextBracket->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 60 | for my $evacuee (@$nonpaired) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 61 | $group->exit($evacuee); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 61 | $evacuee->floating('Down'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 61 | $nextBracket->entry($evacuee); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 60 | my @floaters = map {$_->pairingNumber} @$nonpaired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 60 | my @pairIds = map {$_->pairingNumber} @{$group->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 60 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | "Floating remaining @floaters Down. [$number] @pairIds. @floaters => [$nextNumber] @nextMembers" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 60 | return NEXT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 88 | my $xprime = $group->bigGroupXprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | my $remainingX = $group->{xdeduction}? $xprime - $group->{xdeduction}: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 88 | ▶ | $xprime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 88 | my $remainderGroup = Games::Tournament::Swiss::Bracket->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | score => $group->score, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | remainderof => $group, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | number => "${number}'s Remainder Group", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | xprime => $remainingX, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | # $group->{remainder} ||= $remainderGroup; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 88 | $group->{remainder} = $remainderGroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 88 | my $remaIndex = "${index}Remainder"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 88 | ▶ | if ( $islastBracket and @$nonpaired == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$islastBracket and @$nonpaired == 1
MC/DC100%2/2
$islastBracket and @$nonpaired == 1
$islastBracket
@$nonpaired == 1
Truth table100%3/3
A and B
A= $islastBracketB= @$nonpaired == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 23 | $remaIndex = "${index}Bye"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 23 | $remainderGroup->{number} = "${number}'s Bye"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 88 | $groups->{$remaIndex} = $remainderGroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 88 | my $remainderIndex = $self->nextBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 88 | my $remainder = $groups->{$remainderIndex}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 88 | my $remainderNumber = $remainder->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 88 | for my $remainer (@$nonpaired) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 256 | $group->exit($remainer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # $remainder->entry($remainer); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 256 | $remainderGroup->entry($remainer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 88 | my @remains = map {$_->pairingNumber} @$nonpaired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 88 | my $members = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 88 | my @memberIds = map {$_->pairingNumber} @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 88 | my @next = map {$_->pairingNumber} @{$remainderGroup->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 88 | $self->log( "Remaindering @remains. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | [$number] @memberIds & [$remainderNumber] @next" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 88 | ▶ | $remainderGroup->{c10repaired} = 1 if $group->{c10repaired}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | $remainderGroup->{lowfloaterlastshuffle} = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 88 | ▶ | if $group->{lowfloaterlastshuffle}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 88 | ▶ | $remainderGroup->{c11repaired} = 1 if $group->{c11repaired}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | $remainderGroup->{lastheteroshuffle} = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 88 | ▶ | if $group->{lastheteroshuffle}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 88 | $self->brackets($groups); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 88 | ▶ | if ( $islastBracket ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 43 | return NEXT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 45 | $self->thisBracket($remainderIndex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 45 | my ( $rejectionSlip, @rejections) = $self->rejectionTest(@$nonpaired); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 45 | ▶ | if ( @rejections and not @$nonpaired % 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@rejections and not @$nonpaired % 2
MC/DC100%2/2
@rejections and not @$nonpaired % 2
@rejections
not @$nonpaired % 2
Truth table100%3/3
A and not(B)
A= @rejectionsB= not @$nonpaired % 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 6 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | "$rejectionSlip. $remainderIndex-Group [$remainderNumber] unpairable. Go C10" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 6 | $remainderGroup->{lastshuffle} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 6 | return C10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 39 | else { return C2; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | =head2 c7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | $next = $pairing->c7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | while ( my @s2 = &$next ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | create match cards unless this permutation is incompatible; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | Apply a new transposition of S2 according to D1 and restart at C6. But take precautions to prevent transposing players who are no longer in the bracket, when finding a different pairing, returning from C10,12,13. In particular, when returning from C10, stop when the last alternative pairing for the lowest downfloater has been tried. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 1414 | ▶ | sub c7 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c7: called CC=12 SCAR=25.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 1414 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 1414 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 1414 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 1414 | my $group = $groups->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 1414 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 1414 | ▶ | if ( $self->{lowfloaterlastshuffle} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | $self->log("last C10 transposition in $index-Bracket [$number]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | return C10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 1414 | my $s1 = $group->s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 1414 | my $s2 = $group->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 1414 | my $badpair = $group->badpair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 1414 | ▶ | $badpair = $#$s2 if not defined $badpair; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 1414 | my @newS2 = $group->c7shuffler($badpair); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 1414 | ▶ | unless (@newS2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 461 | $self->log("last transposition in $index-Bracket [$number]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 461 | $group->resetS12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 461 | $group->{lastshuffle} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | $group->{lastheteroshuffle} = 1 if ($group->hetero or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 461 | ▶ | ($group->{remainderof} and $group->{remainderof}->{lastheteroshuffle})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$group->hetero or $group->{"remainderof"} and $group->{"remainderof"}{"lastheteroshuffle"}
$group->{"remainderof"} and $group->{"remainderof"}{"lastheteroshuffle"}
MC/DC100%3/3
$group->hetero or $group->{"remainderof"} and $group->{"remainderof"}{"lastheteroshuffle"}
$group->hetero
$group->{"remainderof"}
$group->{"remainderof"}{"lastheteroshuffle"}
Truth table100%4/4
A or B and C
A= $group->heteroB= $group->{"remainderof"}C= $group->{"remainderof"}{"lastheteroshuffle"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | # return C11 if $group->{c11repaired}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | # return C10 if $group->{c10repaired}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 461 | ▶ | return C8 unless $group->hetero; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 59 | return C9; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 953 | $group->s2( \@newS2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 953 | $group->members( [ @$s1, @newS2 ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 953 | my @newOrder = map { $_->pairingNumber } @newS2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 953 | $self->log( " @newOrder"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 953 | my $lastC10shuffle = $group->{lastC10Alternate}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 953 | ▶ | if ( $lastC10shuffle and ref $lastC10shuffle eq 'ARRAY' and @$lastC10shuffle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$lastC10shuffle and ref $lastC10shuffle eq "ARRAY" and @$lastC10shuffle and &all(sub {
$newOrder[$_] == $lastC10shuffle->[$_];
}
, 0 .. $lastC10shuffle->$#*)
$lastC10shuffle and ref $lastC10shuffle eq "ARRAY" and @$lastC10shuffle
$lastC10shuffle and ref $lastC10shuffle eq "ARRAY"
MC/DC50%2/4
$lastC10shuffle and ref $lastC10shuffle eq "ARRAY" and @$lastC10shuffle and &all(sub {
$newOrder[$_] == $lastC10shuffle->[$_];
}
, 0 .. $lastC10shuffle->$#*)
$lastC10shuffle
ref $lastC10shuffle eq "ARRAY"
@$lastC10shuffle
&all(sub {
$newOrder[$_] == $lastC10shuffle->[$_];
}
, 0 .. $lastC10shuffle->$#*)
Truth table60%3/5
A and B and C and D
A= $lastC10shuffleB= ref $lastC10shuffle eq "ARRAY"C= @$lastC10shuffleD= &all(sub {
$newOrder[$_] == $lastC10shuffle->[$_];
}
, 0 .. $lastC10shuffle->$#*)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 89 | ▶ | and all {$newOrder[$_] == $lastC10shuffle->[$_]} 0..$#$lastC10shuffle ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 16 | $group->{lowfloaterlastshuffle} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 953 | $groups->{ $self->thisBracket } = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 953 | return C6PAIRS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | =head2 c8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | $next = $pairing->c8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | while ( my ($s1, $s2) = &$next ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | create match cards unless this exchange is incompatible; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | In case of a homogeneous (remainder) group: apply a new exchange between S1 and S2 according to D2. Restart at C5. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 402 | ▶ | sub c8 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c8: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 402 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 402 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 402 | my $this = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 402 | my $group = $groups->{$this}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 402 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 402 | my $swapper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 402 | ▶ | if ( $group->c8swapper ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 348 | $swapper = $group->c8swapper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 54 | $swapper = $group->c8iterator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 54 | $group->c8swapper($swapper); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 402 | my ($message, @newMembers) = &$swapper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 402 | $self->log( "$message in $this-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 402 | ▶ | unless (@newMembers) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 168 | $swapper = $group->c8iterator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 168 | $group->c8swapper($swapper); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 168 | return C9; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 234 | my $p = $group->p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 234 | my @s1 = @newMembers[ 0 .. $p - 1 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 234 | my @s2 = @newMembers[ $p .. $#newMembers ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 234 | $group->s1( \@s1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 234 | $group->s2( \@s2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 234 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 234 | "@{[map { $_->pairingNumber } @s1]}, @{[map { $_->pairingNumber } @s2]}" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 234 | $groups->{$this} = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 234 | $self->{brackets} = $groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 234 | return C5; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | =head2 c9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | Games::Tournament::Swiss::Procedure->c9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | Drop, in order, criterion B6 (no identical float to 2 rounds before) and B5 (no identical float to previous round) for downfloats and restart at C4. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 227 | ▶ | sub c9 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c9: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 227 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 227 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 227 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 227 | my $group = $groups->{ $index }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 227 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 227 | ▶ | if ( $group->floatCheckWaive eq 'None' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 67 | $group->floatCheckWaive('B6Down'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 67 | delete $group->{lastshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 67 | delete $group->{lastheteroshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 67 | $self->log( "No pairing with float checks on. Dropping B6 for Downfloats in $index-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 67 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | elsif ( $group->floatCheckWaive eq 'B6Down' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 61 | $group->floatCheckWaive('B5Down'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 61 | delete $group->{lastshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 61 | delete $group->{lastheteroshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 61 | $self->log( "No pairing with B6 check off. Dropping B5 for Downfloats in $index-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 61 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | elsif ( $group->floatCheckWaive eq 'B5Down' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 54 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | "No pairing with all Downfloat checks dropped in $index-Bracket [$number]" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 54 | return C10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | elsif ( $group->floatCheckWaive eq 'B6Up' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 24 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | "No pairing with all Downfloat checks dropped in $index-Bracket [$number]" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 24 | return C10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | elsif ( $group->floatCheckWaive eq 'B5Up' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 20 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | "No pairing with all Downfloat checks dropped in $index-Bracket [$number]" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 20 | return C10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | elsif ( $group->floatCheckWaive eq 'All' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 1 | $group->floatCheckWaive('B6Down'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 1 | $self->log( "No Pairing with all Downfloat checks dropped. Pairing again with B6 dropped in $index-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 1 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | return ERROR, msg => "$index-Bracket [$number] fell through C9"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | =head2 c10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | Games::Tournament::Swiss::Procedure->c10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | In case of a homogeneous remainder group: undo the pairing of the lowest moved down player paired and try to find a different opponent for this player by restarting at C7. If no alternative pairing for this player exists then drop criterion B6 first and then B5 for upfloats and restart at C2 (C4 to avoid p, x resetting.) If we are in a C13 loop (check penultpPrime), avoid the C10 procedure. Why? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 104 | ▶ | sub c10 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c10: called CC=24 SCAR=32.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 104 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 104 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 104 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 104 | my $group = $brackets->{ $index }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 104 | my $groupNumber = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 104 | my $lowFloat = $group->s1->[0]->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 104 | ▶ | if ( $group->{c10repaired} and $group->{lowfloaterlastshuffle}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition100%3/3
$group->{"c10repaired"} and $group->{"lowfloaterlastshuffle"}
MC/DC100%2/2
$group->{"c10repaired"} and $group->{"lowfloaterlastshuffle"}
$group->{"c10repaired"}
$group->{"lowfloaterlastshuffle"}
Truth table100%3/3
A and B
A= $group->{"c10repaired"}B= $group->{"lowfloaterlastshuffle"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 9 | my ($heteroBracket, $heteroNumber, $heteroIndex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 9 | ▶ | if ( $group->{remainderof} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 3 | $heteroBracket = $group->{remainderof}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 3 | $heteroNumber = $heteroBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 3 | $heteroIndex = $self->index($heteroBracket); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 3 | my $repairgroupRemainder = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 3 | my $lowest = $heteroBracket->s1->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 3 | my $lowFloat = $lowest->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 3 | my $inadequateS2member = $heteroBracket->s2->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 3 | my $partnerId = $inadequateS2member->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 3 | my $unpaired = $repairgroupRemainder->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 3 | $repairgroupRemainder->exit($_) for @$unpaired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 3 | $_->floating('') for @$unpaired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 3 | $heteroBracket->entry($_) for @$unpaired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | # $heteroBracket->floatCheckWaive('None'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | # $heteroBracket->badpair(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 3 | $self->thisBracket($heteroIndex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 3 | $repairgroupRemainder->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 3 | delete $repairgroupRemainder->{lowfloaterlastshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 3 | delete $heteroBracket->{lowfloaterlastshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 3 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | "Can't repair lowest downfloater, $lowFloat in $heteroIndex-Bracket [$heteroNumber]" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | elsif ( $group->hetero ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 6 | $heteroBracket = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 6 | $heteroNumber = $groupNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 6 | $heteroIndex = $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 6 | delete $heteroBracket->{lowfloaterlastshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 9 | ▶ | if ( $heteroBracket->floatCheckWaive eq 'B5Up' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 3 | $heteroBracket->floatCheckWaive('All'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 3 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | "Float checks all dropped, but can't repair heterogeneous $index-Bracket [$groupNumber]. Go C11 " ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 3 | return C11; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | ▶ | elsif ( $heteroBracket->floatCheckWaive eq 'B6Down' or | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$heteroBracket->floatCheckWaive eq "B6Down" or $heteroBracket->floatCheckWaive eq "B5Down"
MC/DC100%2/2
$heteroBracket->floatCheckWaive eq "B6Down" or $heteroBracket->floatCheckWaive eq "B5Down"
$heteroBracket->floatCheckWaive eq "B6Down"
$heteroBracket->floatCheckWaive eq "B5Down"
Truth table100%3/3
A or B
A= $heteroBracket->floatCheckWaive eq "B6Down"B= $heteroBracket->floatCheckWaive eq "B5Down"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | $heteroBracket->floatCheckWaive eq 'B5Down' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 3 | $heteroBracket->floatCheckWaive('B6Up'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 3 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | "Dropping B6 for Upfloats in $heteroIndex-Bracket [$heteroNumber]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | elsif ( $heteroBracket->floatCheckWaive eq 'B6Up' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 3 | $heteroBracket->floatCheckWaive('B5Up'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 3 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | "Dropping B5 for Upfloats in $heteroIndex-Bracket [$heteroNumber]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | $self->log( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 6 | "Repairing whole of $heteroIndex-Bracket [$heteroNumber]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 6 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | elsif ( $group->{remainderof} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 32 | ▶ | if ( $group->{remainderof}->{c11repaired} or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$group->{"remainderof"}{"c11repaired"} or $group->{"remainderof"}{"c12repaired"}
MC/DC50%1/2
$group->{"remainderof"}{"c11repaired"} or $group->{"remainderof"}{"c12repaired"}
$group->{"remainderof"}{"c11repaired"}
$group->{"remainderof"}{"c12repaired"}
Truth table66%2/3
A or B
A= $group->{"remainderof"}{"c11repaired"}B= $group->{"remainderof"}{"c12repaired"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | $group->{remainderof}->{c12repaired} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 17 | $self->log( "Passing $index-Bracket [$groupNumber] to C11." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 17 | return C11; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 15 | my $remaindered = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 15 | my @remaindered = map {$_->pairingNumber} @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 15 | my $heteroBracket = $group->{remainderof}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 15 | my $index = $self->index($heteroBracket); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 15 | my $number = $heteroBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 15 | my @ids = map { $_->pairingNumber } @{ $heteroBracket->members }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 15 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | "Pairing of @ids in $index-Bracket [$number] failed pairing @remaindered in remainder group." ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 15 | my $matches = delete $self->matches->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 15 | $group->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | # $heteroBracket->floatCheckWaive('None'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 15 | $self->thisBracket( $index ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 15 | $group->exit($_) for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 15 | $_->floating('') for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 15 | $heteroBracket->entry($_) for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 15 | ▶ | if ( not $heteroBracket->{c10repaired} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 3 | $heteroBracket->{c10repaired} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 3 | my $s1 = $heteroBracket->s1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 3 | my $s2 = $heteroBracket->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | my @wellpairedS2 = map { $s2->[$_] } 0..$#$s1-1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 3 | my @unpairedS2 = map { $s2->[$_] } $#$s1+1..$#$s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 3 | my $lastShufflePossibility = ( $self->rank(@unpairedS2) )[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 3 | my @lastIds = map { $_->pairingNumber } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | @wellpairedS2, $lastShufflePossibility; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 3 | $heteroBracket->{lastC10Alternate} = \@lastIds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 3 | my $lowest = $s1->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 3 | my $id = $lowest->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 3 | my $match = $matches->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 3 | my $partner = $lowest->myOpponent($match); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 3 | my $partnerId = $partner->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 3 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | "Unpairing lowest downfloater, $id and $partnerId in $index-Bracket [$number] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | Returning @remaindered to $index-Bracket [$number] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | Trying different partner for $id in $index-Bracket [$number]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 3 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | elsif ( $group->{lastshuffle} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 12 | $self->log("Trying next pairing in $index-Bracket [$number]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 12 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | elsif ( $group->floatCheckWaive eq 'B5Down' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 25 | $group->floatCheckWaive('B6Up'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 25 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | "No more pairings. Dropping B6 for Upfloats in $index-Bracket [$groupNumber]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 25 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | elsif ( $group->floatCheckWaive eq 'B6Up' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 21 | $group->floatCheckWaive('B5Up'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 21 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | "No more pairings. Dropping B5 for Upfloats in $index-Bracket [$groupNumber]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 21 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | elsif ( $group->floatCheckWaive eq 'B5Up' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 17 | $group->floatCheckWaive('All'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 17 | $self->log("Float checks all dropped in $index-Bracket [$groupNumber]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 17 | return C11; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | elsif ( $group->floatCheckWaive eq 'All' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | $group->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | $self->log("Float checks already off in $index-Bracket [$groupNumber]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | return C11; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | #elsif ( $group->{lastshuffle} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | # $self->log( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | # "Repairing of whole $index-Bracket [$groupNumber] failed. Go C11" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | # return C11; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | return ERROR, msg => "$index-Bracket [$groupNumber] fell through C10"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | =head2 c11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | Games::Tournament::Swiss::Procedure->c11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | As long as x (xprime) is less than p: increase it by 1. When pairing a remainder group undo all pairings of players moved down also. Restart at C3. (We were restarting at C7 after resetting the C7shuffler (Why?) We restart at C4 (to avoid resetting p) the 1st time, and C7 after that). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 37 | ▶ | sub c11 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c11: called CC=20 SCAR=31.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 37 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 37 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 37 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 37 | my $group = $brackets->{ $index }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 37 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 37 | my ($heteroBracket, @remaindered); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 37 | my $xprime = $group->xprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 37 | my $pprime = $group->pprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 37 | my $bigGroupXprime = $group->bigGroupXprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 37 | my $bigGroupPprime = $group->bigGroupPprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 37 | ▶ | if ( $group->{c11repaired} and $group->{lastheteroshuffle} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%3/3
$group->{"c11repaired"} and $group->{"lastheteroshuffle"}
MC/DC100%2/2
$group->{"c11repaired"} and $group->{"lastheteroshuffle"}
$group->{"c11repaired"}
$group->{"lastheteroshuffle"}
Truth table100%3/3
A and B
A= $group->{"c11repaired"}B= $group->{"lastheteroshuffle"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 2 | ▶ | if ( $heteroBracket = $group->{remainderof} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 2 | my $remaindered = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 2 | @remaindered = map { $_->pairingNumber } @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 2 | $group->exit($_) for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 2 | $_->floating('') for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 2 | $heteroBracket->entry($_) for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 2 | delete $group->{lastheteroshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 2 | $group->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | elsif ( $group->hetero ) { $heteroBracket = $group; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 2 | my $heteroIndex = $self->index($heteroBracket); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 2 | $self->thisBracket( $heteroIndex ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 2 | my $heteroNumber = $heteroBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 2 | my $heteroMembers = $heteroBracket->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 2 | my @heteroIds = map { $_->pairingNumber } @$heteroMembers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 2 | $heteroIndex = $self->index($heteroBracket); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 2 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | "Repairing of $heteroIndex-Bracket [$heteroNumber] failed. No more pairings with X=$bigGroupXprime" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 2 | delete $heteroBracket->{lastheteroshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 2 | ▶ | if ( $bigGroupXprime < $bigGroupPprime ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 2 | $heteroBracket->bigGroupXprime(++$bigGroupXprime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 2 | $heteroBracket->{c8swapper} = $heteroBracket->c8iterator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 2 | $heteroBracket->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 2 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | "Retrying with X=$bigGroupXprime. All float checks on in $heteroIndex-Bracket [$heteroNumber]" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 2 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | "X=P=$bigGroupPprime, no more X increases in $index-Bracket [$number]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | Giving up on C11 Repair. Go C12"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | return C12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | elsif ( $group->{c10repaired} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 3 | my $matches = $self->matches->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 3 | ▶ | delete $self->matches->{$index} if $matches; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 3 | $self->log( "Deleting all matches in $index-Bracket [$number]"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 3 | my $members = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 3 | my @ids = map {$_->pairingNumber} @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 3 | $group->bigGroupXprime(++$bigGroupXprime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 3 | $group->xprime(++$xprime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 3 | $group->{c10repaired} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 3 | $group->{lastshuffle} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 3 | delete $group->{lastheteroshuffle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 3 | $group->{c11repaired} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 3 | $group->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 3 | ▶ | my $message = $group->{remainder}? "X=$bigGroupXprime": "x=$xprime"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 3 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | "Bracket ${number}'s C11 Repairing: @ids, with $message" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 3 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | elsif ( $group->{remainderof} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 15 | ▶ | if ( $group->{remainderof}->{c12repaired} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | $self->log( "Passing to C12." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | return ERROR, msg => "$number($index) shouldn't pass this way"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | return C12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | elsif ( $group->{c11repaired} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 15 | $heteroBracket = $group->{remainderof}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 15 | my $remaindered = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 15 | my @remaindered = map { $_->pairingNumber } @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 15 | my $heteroNumber = $heteroBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 15 | my $heteroIndex = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 15 | my $heteroMembers = $heteroBracket->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 15 | my @heteroIds = map { $_->pairingNumber } @$heteroMembers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | # $heteroBracket->bigGroupXprime(++$bigGroupXprime); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 15 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | "Repairing of @heteroIds in $heteroIndex-Bracket [$heteroNumber] failed pairing @remaindered. Trying next pairing with X=$bigGroupXprime" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 15 | $group->exit($_) for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 15 | $_->floating('') for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 15 | $heteroBracket->entry($_) for @$remaindered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 15 | $group->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 15 | $self->thisBracket( $heteroIndex ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 15 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | elsif ( $xprime < $pprime ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 13 | $group->xprime(++$xprime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 13 | $self->log( "x=$xprime" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 13 | ▶ | if ( $group->{remainder} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | $heteroBracket = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | delete $self->matches->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | $self->log("Undoing all hetero $index-Bracket [$number] matches."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 0 | $self->log( "All float checks on in $index-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | $heteroBracket->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | $heteroBracket->resetShuffler; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 13 | $group->{c8swapper} = $group->c8iterator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 13 | $group->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 13 | $self->log( "All float checks on in $index-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 13 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 4 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | "x=p=$bigGroupPprime, no more x increases in $index-Bracket [$number]" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 4 | return C12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | return ERROR, msg => "$number($index) fell through C11", pairing => $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | =head2 c12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | Games::Tournament::Swiss::Procedure->c12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | If the group contains a player who cannot be paired without violating B1 or B2 and this is a heterogeneous group, undo the pairing of the previous score bracket. If in this previous score bracket a pairing can be made whereby another player will be moved down to the current one, and this now allows p pairing to be made then this pairing in the previous score bracket will be accepted. (If there was only one (or two) players in the previous score bracket, obviously (heh-heh) there is no use going back and trying to find another pairing). Using a c12repaired flag to tell if this is the 2nd time through (but what if this is a backtrack to a different bracket?). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 4 | ▶ | sub c12 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c12: called CC=30 SCAR=54.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 4 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 4 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 4 | my $group = $brackets->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 4 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 4 | my $first = $self->firstBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 4 | ▶ | if ( $index eq $first ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 1 | $self->log( "No C12 repair from first $index-Bracket [$number]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 1 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 3 | my $prevIndex = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 3 | my $previous = $brackets->{$prevIndex}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 3 | my $prevNumber = $previous->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 3 | my $previousMembers = $previous->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 3 | ▶ | if ( $group->{c12repaired} or $previous->{c12repaired} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition100%3/3
$group->{"c12repaired"} or $previous->{"c12repaired"}
MC/DC100%2/2
$group->{"c12repaired"} or $previous->{"c12repaired"}
$group->{"c12repaired"}
$previous->{"c12repaired"}
Truth table100%3/3
A or B
A= $group->{"c12repaired"}B= $previous->{"c12repaired"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 2 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | "Repairing of $prevIndex-Bracket [$prevNumber] failed to pair $index [$number]. Go to C13"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 2 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | elsif ( $group->{c11repaired} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | ▶ | if (not $previous->{c12repaired}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | my @downfloaters = $group->downFloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | my @floatIds = map { $_->pairingNumber } @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 0 | my $score = $previous->score; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | my $matches = $self->matches->{$prevIndex}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | ▶ | delete $self->matches->{$prevIndex} if $matches; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | "Deleting matches in $prevIndex-Bracket [$prevNumber], home of @floatIds"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 0 | my $paired = $previous->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 0 | my @ids = map {$_->pairingNumber} @downfloaters, @$paired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | "$prevIndex-Bracket [$prevNumber] C12 Repairing: @ids"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | $group->exit($_) for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | $_->floating('') for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | $previous->entry($_) for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | $previous->{c12repaired} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | $previous->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | $previous->{c8swapper} = $previous->c8iterator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 0 | $previous->resetS12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | my $s2 = $previous->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | $self->thisBracket($prevIndex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | ▶ | elsif ( $group->{remainderof} and $group->{remainderof}->{c12repaired} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$group->{"remainderof"} and $group->{"remainderof"}{"c12repaired"}
MC/DC0%0/2
$group->{"remainderof"} and $group->{"remainderof"}{"c12repaired"}
$group->{"remainderof"}
$group->{"remainderof"}{"c12repaired"}
Truth table33%1/3
A and B
A= $group->{"remainderof"}B= $group->{"remainderof"}{"c12repaired"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | my $repairGroupIndex = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 0 | my $heteroBracket = $group->{remainderof}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | my $repairGroupNumber = $heteroBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | my $c11RepairRemainder = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | $self->log( "No repairings in $repairGroupNumber. Go to C13." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 0 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | ▶ | elsif ( $group->{remainderof} and $group->{remainderof}->{c11repaired} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$group->{"remainderof"} and $group->{"remainderof"}{"c11repaired"}
MC/DC0%0/2
$group->{"remainderof"} and $group->{"remainderof"}{"c11repaired"}
$group->{"remainderof"}
$group->{"remainderof"}{"c11repaired"}
Truth table33%1/3
A and B
A= $group->{"remainderof"}B= $group->{"remainderof"}{"c11repaired"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 0 | my $c11Remainder = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | my $c11RepairIndex = $prevIndex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | my $c11RepairGroup = $previous; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | my $c11RepairNumber = $prevNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | my $paired = $previousMembers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 0 | my $score = $c11RepairGroup->score; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | my @ids = map {$_->pairingNumber} @$paired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 0 | my $matches = $self->matches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 0 | delete $matches->{ $c11RepairIndex }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 0 | ▶ | delete $matches->{$c11Remainder} if $matches->{$c11Remainder}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | "Undoing Bracket $c11RepairIndex-Bracket ($c11RepairNumber) pairs, @ids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 0 | $self->thisBracket($c11RepairIndex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 0 | my $remainderMembers = $c11Remainder->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 0 | $c11Remainder->exit($_) for @$remainderMembers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | $_->floating('') for @$remainderMembers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | $c11RepairGroup->entry($_) for @$remainderMembers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 0 | $c11Remainder->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | $self->log( "Dissolving $c11RepairIndex-Bracket's Remainder Group" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 0 | my $newPrevIndex = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | 0 | my $bracketAbove = $brackets->{$newPrevIndex}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 0 | my $aboveNumber = $bracketAbove->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | ▶ | if ( $bracketAbove and $bracketAbove->hetero ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$bracketAbove and $bracketAbove->hetero
MC/DC0%0/2
$bracketAbove and $bracketAbove->hetero
$bracketAbove
$bracketAbove->hetero
Truth table0%0/3
A and B
A= $bracketAboveB= $bracketAbove->hetero
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | my $key = $score . "C12Repair"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | my $c12RepairGroup = Games::Tournament::Swiss::Bracket->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | score => $score, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | c12repaired => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | c12down => $c11RepairGroup, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | number => "$aboveNumber(post-C12)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 0 | my @downfloaters = $c11RepairGroup->downFloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | $c11RepairGroup->exit($_) for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | $_->floating('') for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 0 | $c12RepairGroup->entry($_) for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | $c11RepairGroup->{c12up} = $c12RepairGroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | my @floatIds = map {$_->pairingNumber} @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 0 | my @prevIds = map {$_->pairingNumber} @{$c12RepairGroup->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | my @thisIds = map {$_->pairingNumber} @{$group->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | $self->log("C12 Repairing of previous $newPrevIndex-Bracket"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | $self->log(qq/Unfloating @floatIds back from $number ($index). /); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | "$index-Bracket [$number]: @thisIds & [$prevNumber]: @prevIds"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 0 | $bracketAbove->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 0 | $c12RepairGroup->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 0 | $c12RepairGroup->{c8swapper} = $c12RepairGroup->c8iterator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | $c12RepairGroup->resetS12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 0 | $brackets->{$key} = $c12RepairGroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | $self->thisBracket($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 0 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | elsif ( not $bracketAbove->hetero ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | "No C11 OR C12 repairings of $c11RepairIndex-Bracket ($c11RepairNumber)"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 0 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | elsif ( $group->hetero ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 1 | my @downfloaters = $group->downFloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 1 | my $floaterSourceIndex = $prevIndex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 1 | my $floaterSource = $previous; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 1 | my $floaterSourceNumber = $prevNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 1 | my $paired = $floaterSource->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 1 | my $score = $floaterSource->score; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 1 | my @ids = map {$_->pairingNumber} @$paired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 1 | my $matches = $self->matches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 1 | delete $matches->{ $prevIndex }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 1 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | "Undoing Bracket $floaterSourceNumber($floaterSourceIndex) pairs, @ids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 1 | my $key = $score . "C12Repair"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 1 | my $c12RepairGroup = Games::Tournament::Swiss::Bracket->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | score => $score, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | c12repaired => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | c12down => $group, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | number => "$floaterSourceNumber(post-C12)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 1 | $group->exit($_) for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 1 | $group->c8swapper(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 1 | $floaterSource->exit($_) for @$paired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 1 | $_->floating('') for @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 1 | $c12RepairGroup->entry($_) for @downfloaters, @$paired; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 1 | $floaterSource->{c12repair} = $c12RepairGroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 1 | $group->{c12up} = $c12RepairGroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 1 | my @floatIds = map {$_->pairingNumber} @downfloaters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 1 | my @prevIds = map {$_->pairingNumber} @{$c12RepairGroup->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 1 | my @thisIds = map {$_->pairingNumber} @{$group->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 1 | $self->log(qq/Unfloating @floatIds back from $number ($index). /); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 1 | $self->log("[$number]: @thisIds & [$prevNumber]: @prevIds"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 1 | $floaterSource->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 1 | $c12RepairGroup->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 1 | $c12RepairGroup->{c8swapper} = $c12RepairGroup->c8iterator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 1 | $c12RepairGroup->resetS12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 1 | my $s2 = $c12RepairGroup->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 1 | $c12RepairGroup->badpair($#$s2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 1 | $brackets->{$key} = $c12RepairGroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 1 | $self->thisBracket($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 1 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | elsif ( not $group->hetero ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | "$index-Bracket [$number] not heterogeneous. Passing to C13."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | 0 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | return ERROR, msg => "$index-Bracket [$number] fell through C12"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | =head2 c13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | Games::Tournament::Swiss::Procedure->c13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | If the lowest score group contains a player who cannot be paired without violating B1 or B2 or who, if they are the only player in the group, cannot be given a bye (B1b), the pairing of the penultimate score bracket is undone. Try to find another pairing in the penultimate score bracket which will allow a pairing in the lowest score bracket. If in the penultimate score bracket p becomes zero (i.e. no pairing can be found which will allow a correct pairing for the lowest score bracket) then the two lowest score brackets are joined into a new lowest score bracket. Because now another score bracket is the penultimate one C13 can be repeated until an acceptable pairing is obtained. XXX Perhaps all the players from the old penultimate bracket were floated down. eg, t/cc6619.t. As a hack unfloat only those with the same score as the new penultimate bracket. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | TODO not finding a pairing is not a program ERROR, but a LAST state. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 92 | ▶ | sub c13 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c13: called CC=18 SCAR=28.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | 92 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 92 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 92 | my $matches = $self->matches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | 92 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 92 | my $group = $brackets->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 92 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 92 | my $members = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | 92 | ▶ | unless ($index eq $self->lastBracket) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 2 | $self->log("$index-Bracket [$number] not last group. Passing to C14" ) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 2 | return C14; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | 90 | ▶ | if ( $index eq $self->firstBracket ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 1 | return LAST, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | msg => "All joined into one $index bracket, but no pairings! Sorry"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 89 | ▶ | if ( @$members == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 32 | my $lastone = $members->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 32 | my $pairingN = $lastone->pairingNumber; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 32 | my $id = $lastone->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 32 | $self->log( "One unpaired player, $pairingN in last bracket $number." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 32 | my $byeGone = $self->byes->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 32 | ▶ | if ( not $byeGone) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 30 | $self->byer($lastone); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 30 | return BYE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 2 | $self->log( "B1b: But that player, id $id had Bye in round $byeGone." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 59 | my $penultimateIndex = $self->previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 59 | my $penultimateBracket = $brackets->{$penultimateIndex}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 59 | my $penultimateNumber = $penultimateBracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 59 | my $penultScore = $penultimateBracket->score; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | # $penultimateBracket->floatCheckWaive('None'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | 59 | delete $matches->{ $penultimateIndex }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 59 | $self->log( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | "Undoing $penultimateIndex-Bracket [$penultimateNumber] matches"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 59 | my @returnees = grep { $_->score == $penultScore } @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 59 | ▶ | if ( @returnees ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 57 | my @floaterIds = map { $_->pairingNumber } @returnees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 57 | $self->log( "Unfloating @floaterIds back from $number." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 57 | $group->exit($_) for @returnees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | 57 | $_->floating('') for @returnees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 57 | $penultimateBracket->entry($_) for @returnees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | 57 | $_->floating('') for ( $penultimateBracket->upFloaters ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 57 | $penultimateBracket->resetShuffler; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | 57 | $brackets->{ $index } = $group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 59 | my $penultp = $penultimateBracket->p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 59 | my $penultxPrime = $penultimateBracket->xprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 59 | my $penultpPrime = $penultimateBracket->pprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 59 | ▶ | if ($penultpPrime and not @returnees) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$penultpPrime and not @returnees
MC/DC50%1/2
$penultpPrime and not @returnees
$penultpPrime
not @returnees
Truth table66%2/3
A and not(B)
A= $penultpPrimeB= not @returnees
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 2 | $penultpPrime -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 2 | ▶ | $penultxPrime -= 1 if $penultxPrime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 59 | $penultimateBracket->pprime($penultpPrime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 59 | $penultimateBracket->xprime($penultxPrime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | 59 | $self->log( "penultimate p=$penultpPrime." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 59 | ▶ | if ( $penultpPrime == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 1 | my $evacuees = $penultimateBracket->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 1 | my @evacuIds = map { $_->pairingNumber } @$evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 1 | $penultimateBracket->exit($_) for @$evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | 1 | $_->floating('Down') for @$evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | 1 | $group->entry($_) for @$evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 1 | $penultimateBracket->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 1 | my @finalIds = map { $_->pairingNumber } @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 0 | my @penultimateIds = map { $_->pairingNumber } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 1 | @{$penultimateBracket->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | 1 | $self->log( "Joining Bracket $penultimateNumber, $number." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 1 | $self->log( "[$penultimateNumber] @evacuIds => [$number] @finalIds" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | 1 | $group->resetShuffler; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | 1 | return C1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 58 | ▶ | if ( $penultpPrime > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 207 | my @penultids = map {$_->pairingNumber} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 58 | @{$penultimateBracket->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 58 | my @finalids = map {$_->pairingNumber} @{$group->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 58 | $self->log( "Re-pairing Bracket $penultimateNumber." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 58 | $self->log( "[$penultimateNumber]: @penultids & [$number]: @finalids" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 58 | my $s2 = $penultimateBracket->s2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 58 | $penultimateBracket->badpair($#$s2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | 58 | $self->thisBracket($penultimateIndex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | 58 | $self->penultpPrime( $penultpPrime ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 58 | return C7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | else { return ERROR, msg => "Fell through C13 in $number ($index)"; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | =head2 bye | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | $self->bye | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | The last, singular, unpairable player is given a bye. B2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | 30 | ▶ | sub bye { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bye: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 30 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 30 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 30 | my $bracket = $brackets->{$index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 30 | my $members = $bracket->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 30 | my $byer = $self->byer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 30 | my $id = $byer->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 30 | my $byes = $self->byes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 30 | my $round = $self->round; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 30 | my $matches = $self->matches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 30 | ▶ | my $byeindex = $index =~ /Bye$/? $index : $index . 'Bye'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 30 | my $game = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | Games::Tournament::Card->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | round => $round, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | result => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | contestants => { Bye => $byer } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 30 | $game->float($byer, 'Down'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 30 | $matches->{$byeindex} = [ $game ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 30 | $self->log( "OK." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 30 | $byes->{$id} = $round; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 30 | return LAST; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | =head2 c14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | Games::Tournament::Swiss::Procedure->c14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | Decrease p (pprime) by 1 (and if the original value of x was greater than zero decrease x by 1 as well). As long as p is unequal to zero restart at C4. (At C13, if this is final bracket, because this means it is unpairable.) If p equals zero the entire score bracket is moved down to the next one. Restart with this score bracket at C1. (If it is the penultimate bracket, and the final bracket is unpairable, the final bracket is moved up, but I guess that's the same thing. C13 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 2 | ▶ | sub c14 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c14: called CC=18 SCAR=38.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 2 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 2 | my $index = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 2 | my $group = $groups->{ $index }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 2 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 2 | my $members = $group->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 2 | my $p = $group->p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 2 | my $x = $group->xprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 2 | my $pprime = $group->pprime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 2 | ▶ | if ($pprime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | 2 | $pprime -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 2 | ▶ | $x -= 1 if $x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 2 | $group->pprime($pprime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 2 | $group->xprime($x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 2 | $group->floatCheckWaive('None'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 2 | $self->log( "Bracket $number, now p=$pprime" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 2 | my $next = $self->nextBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | 2 | my $nextgroup = $groups->{$next}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 2 | ▶ | if ( $pprime == 0 and $index eq $self->lastBracket and defined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition33%2/6
$pprime == 0 and $index eq $self->lastBracket and defined $self->penultpPrime
$pprime == 0 and $index eq $self->lastBracket
MC/DC0%0/3
$pprime == 0 and $index eq $self->lastBracket and defined $self->penultpPrime
$pprime == 0
$index eq $self->lastBracket
defined $self->penultpPrime
Truth table25%1/4
A and B and C
A= $pprime == 0B= $index eq $self->lastBracketC= defined $self->penultpPrime
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | $self->penultpPrime ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 0 | $self->penultpPrime(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | 0 | $self->previousBracket($group); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 0 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | ▶ | elsif ( $pprime < $p and $index eq $self->lastBracket ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$pprime < $p and $index eq $self->lastBracket
MC/DC0%0/2
$pprime < $p and $index eq $self->lastBracket
$pprime < $p
$index eq $self->lastBracket
Truth table33%1/3
A and B
A= $pprime < $pB= $index eq $self->lastBracket
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 0 | $self->penultpPrime(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 0 | return C13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | elsif ($pprime > 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | $self->log( "Trying to pair Bracket $index ($number) again" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 0 | return C4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | elsif ( $nextgroup->{remainderof} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 0 | my $returners = $nextgroup->members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 0 | $nextgroup->exit($_) for @$returners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 0 | $_->floating('') for @$returners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 0 | $group->entry($_) for @$returners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 0 | $group->naturalize($_) for @$returners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 0 | my $remainderNumber = $nextgroup->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | my @remainderIds = map { $_->pairingNumber } @$returners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 0 | my @heteroIds = map { $_->pairingNumber } @{$group->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 0 | $self->log( "Moving all Group $remainderNumber members back to $number." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | $self->log( "@remainderIds => Bracket $number: @heteroIds" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 0 | $self->thisBracket($index); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 0 | $nextgroup->resetShuffler; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 0 | $nextgroup->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 0 | return C1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 2 | my @evacuees = @$members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 2 | $group->exit($_) for @evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 2 | $_->floating('Down') for @evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 2 | $nextgroup->entry($_) for @evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 2 | $nextgroup->naturalize($_) for @evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 2 | my $nextNumber = $nextgroup->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | 2 | my @thisMemberIds = map { $_->pairingNumber } @evacuees; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 2 | my @nextMemberIds = map { $_->pairingNumber } @{$nextgroup->members}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 2 | $self->log( "Moving down all Bracket $number($next), to $nextNumber." ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 2 | $self->log( "@thisMemberIds => Bracket $nextNumber: @nextMemberIds" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 2 | $self->thisBracket($next); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 2 | $nextgroup->resetShuffler; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 2 | $group->dissolved(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 2 | return C1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | =head2 colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | $next = $pairing->c7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | while ( my @s2 = &$next ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | create match cards unless this permutation is incompatible; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | After an acceptable pairing is achieved that doesn't violate the one-time match only principle (B1) and the 2-game maximum on difference between play in one role over that in the other role (B2), roles are allocated so as to grant the preferences of both players, or grant the stronger preference, or grant the opposite roles to those they had when they last played a round in different roles, or grant the preference of the higher ranked player, in that order. (E) A Games::Tournament::Card object, records round, contestants, (undefined) result, and floats (A4). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 194 | ▶ | sub colors { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
colors: called CC=24 SCAR=32.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 194 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 194 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 194 | my $groups = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | 194 | my $round = $self->round; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 194 | my $thisGroup = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 194 | my $group = $groups->{$thisGroup}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 194 | my $number = $group->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | 194 | my $pairs = $args{paired}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 194 | my ($message, @bracketMatches); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 194 | for my $pair ( @$pairs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 250 | my @pair = @$pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 250 | my @rolehistory = ( map { $pair[$_]->rolesPlayedList } 0, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 250 | my @lastdiff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | 250 | for my $lookback ( 1 .. $round - FIRSTROUND ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 318 | ▶ | last if notall { $_->firstround <= $round-$lookback } @pair; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 317 | my $s1role = $rolehistory[0]->[-$lookback]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 317 | my $s2role = $rolehistory[1]->[-$lookback]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 317 | my @ids = map {$_->id} @pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | # die "Missing roles for Players @ids in Round " . ($round-$lookback) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | last | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 317 | ▶ | unless $s1role and $s2role; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$s1role and $s2role
MC/DC100%2/2
$s1role and $s2role
$s1role
$s2role
Truth table100%3/3
A and B
A= $s1roleB= $s2role
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 300 | ▶ | next if $s1role eq $s2role; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 167 | ▶ | next unless 2 == grep { $_ eq (ROLES)[0] or $_ eq (ROLES)[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_ eq (&ROLES())[0] || $_ eq (&ROLES())[1]
MC/DC0%0/2
$_ eq (&ROLES())[0] || $_ eq (&ROLES())[1]
$_ eq (&ROLES())[0]
$_ eq (&ROLES())[1]
Truth table66%2/3
A || B
A= $_ eq (&ROLES())[0]B= $_ eq (&ROLES())[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | ($s1role, $s2role); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | 167 | @lastdiff = ($s1role, $s2role); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 167 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 250 | my ( $contestants, $stronger, $diff ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 250 | my @roles = map { $_->preference->role } @pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 250 | my @strengths = map { $_->preference->strength } @pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 250 | my $rule; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 250 | ▶ | if ( not $roles[0] and not $roles[1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$roles[0] or $roles[1]
MC/DC0%0/2
$roles[0] or $roles[1]
$roles[0]
$roles[1]
Truth table66%2/3
A or B
A= $roles[0]B= $roles[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 0 | ( $roles[0], $roles[1] ) = $self->randomRole; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 0 | $rule = 'No prefs'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 250 | ▶ | if ( not $roles[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 4 | ▶ | $roles[0] = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | ( $roles[1] eq (ROLES)[1] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | ? (ROLES)[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | : (ROLES)[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 4 | $rule = 'No S1 pref'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | 250 | ▶ | if ( not $roles[1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 31 | ▶ | $roles[1] = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | ( $roles[0] eq (ROLES)[1] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | ? (ROLES)[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | : (ROLES)[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 31 | $rule = 'No S2 pref'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | 250 | ▶ | if ( $roles[0] ne $roles[1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 193 | $contestants = { $roles[0] => $pair[0], $roles[1] => $pair[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 193 | $rule = 'E1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | elsif ( $strengths[0] ne $strengths[1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 18 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | defined( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | $stronger = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 36 | grep { $pair[$_]->preference->strength eq 'Absolute' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 .. 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | )[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | elsif ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | defined( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | $stronger = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 14 | grep { $pair[$_]->preference->strength eq 'Strong' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 .. 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | )[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | elsif ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | defined( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | $stronger = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 0 | grep { $pair[$_]->preference->strength eq 'Mild' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 0 .. 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | )[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | 18 | my $strongerRole = $pair[$stronger]->preference->role; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 18 | ▶ | my $weaker = $stronger == 0 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 18 | my $weakerRole = ( grep { $_ ne $strongerRole } ROLES )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 18 | $contestants = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | $strongerRole => $pair[$stronger], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | $weakerRole => $pair[$weaker] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 18 | $rule = 'E2'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | elsif ( @lastdiff ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 8 | $contestants = {$lastdiff[1] => $pair[0], $lastdiff[0] => $pair[1]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 8 | $rule = 'E3'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 31 | my $rankerRole = $pair[0]->preference->role; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 31 | my $otherRole = ( grep { $_ ne $rankerRole } ROLES )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 31 | $contestants = { $rankerRole => $pair[0], $otherRole => $pair[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | 31 | $rule = 'E4'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | $message .= $rule . ' ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | $contestants->{ (ROLES)[0] }->pairingNumber . "&" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | 250 | $contestants->{ (ROLES)[1] }->pairingNumber . ' '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | 250 | my $game = Games::Tournament::Card->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | round => $self->round, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | result => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | contestants => $contestants, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | $game->float($contestants->{$_}, $contestants->{$_}->floating || 'Not') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | 250 | ▶ | for ROLES; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$contestants->{$_}->floating || 'Not'
MC/DC100%1/1
$contestants->{$_}->floating || 'Not'
$contestants->{$_}->floating
Truth table100%2/2
A
A= $contestants->{$_}->floating
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | 250 | push @bracketMatches, $game; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | # $self->previousBracket($group); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 194 | return $message, @bracketMatches; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | =head2 brackets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | $pairing->brackets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | Gets/sets all the brackets which we are pairing. The order of this array is important. The brackets are paired in order. I was storing these as an anonymous array of score group (bracket) objects. But the problem of remainder groups has forced me to store as a hash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 8046 | ▶ | sub brackets { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
brackets: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 8046 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | 8046 | my $brackets = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | 8046 | ▶ | if ( defined $brackets ) { $self->{brackets} = $brackets; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | 7392 | elsif ( $self->{brackets} ) { return $self->{brackets}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | =head2 bracketOrder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | $pairing->bracketOrder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | Gets an array of homogeneous and heterogeneous brackets in order with remainder groups (iff they have been given bracket status and only until this status is withdrawn) coming after the heterogeneous groups from which they are formed. This ordered array is necessary, because remainder groups come into being and it is difficult to move back to them. Do we re-pair the remainder group, or the whole group from which it came? Remember to keep control of remainder groups' virtual bracket status with the dissolved field. This method depends on each bracket having an index made up of the bracket score and a 'Remainder' or other appropriate suffix, if it is a remainder or other kind of sub-bracket. We rely on the lexico ordering of the suffixes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | TODO No need to create scoresAndTags list of lists here. Just do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | @index{@indexes} = map { m/^(\d*\.?\d+)(\D.*)?$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | {score => $1, tag => $2||'' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | } @indexes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | 1522 | ▶ | sub bracketOrder { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bracketOrder: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | 1522 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 1522 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | 1522 | my @indexes = grep { not $brackets->{$_}->dissolved } keys %$brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 1522 | my @scoresAndTags = map { m/^(\d*\.?\d+)(\D.*)?$/; [$1,$2] } @indexes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 1522 | my %index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 1522 | ▶ | @index{@indexes} = map {{score => $_->[0], tag => $_->[1] || '' }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->[1] || ''
MC/DC100%1/1
$_->[1] || ''
$_->[1]
Truth table100%2/2
A
A= $_->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | @scoresAndTags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 1522 | my @indexOrder = sort { $index{$b}->{score} <=> $index{$a}->{score} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 6053 | ▶ | $index{$a}->{tag} cmp $index{$b}->{tag} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$index{$b}{'score'} <=> $index{$a}{'score'} || $index{$a}{'tag'} cmp $index{$b}{'tag'}
MC/DC0%0/2
$index{$b}{'score'} <=> $index{$a}{'score'} || $index{$a}{'tag'} cmp $index{$b}{'tag'}
$index{$b}{'score'} <=> $index{$a}{'score'}
$index{$a}{'tag'} cmp $index{$b}{'tag'}
Truth table66%2/3
A || B
A= $index{$b}{'score'} <=> $index{$a}{'score'}B= $index{$a}{'tag'} cmp $index{$b}{'tag'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | @indexes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 1522 | unshift @indexOrder, 'START'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | 1522 | return @indexOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | =head2 firstBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | $pairing->firstBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | Gets the firstBracket. This is the undissolved bracket with the highest score. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | 188 | ▶ | sub firstBracket { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
firstBracket: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | 188 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 188 | my @scoreOrder = $self->bracketOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 188 | my $startBlock = shift @scoreOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | 188 | my $firstBracket = shift @scoreOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | 188 | return $firstBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | =head2 lastBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | $pairing->lastBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | Gets the lastBracket. With the joining of score brackets and addition of remainder groups, this bracket may change. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | 588 | ▶ | sub lastBracket { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lastBracket: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | 588 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 588 | my @scoreOrder = $self->bracketOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | 588 | return pop @scoreOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | =head2 nextBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | $pairing->nextBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | Gets the nextBracket to that which we are pairing now. This may or may not be a remainder group, depending on whether they have been given virtual bracket status. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | 414 | ▶ | sub nextBracket { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nextBracket: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | 414 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | 414 | my $place = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | 414 | my @scoreOrder = $self->bracketOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 414 | my $nextBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 414 | ▶ | if (defined $place) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | 414 | my $next = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | 414 | for my $index ( @scoreOrder ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | 1524 | $nextBracket = $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | 1524 | ▶ | last if $next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | 1115 | ▶ | $next++ if $index eq $place; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 414 | ▶ | return $nextBracket unless $nextBracket eq $place; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | =head2 previousBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | $pairing->previousBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | Gets the previousBracket to that which we are pairing now. This may or may not be a remainder group, depending on whether they have been given virtual bracket status. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | 310 | ▶ | sub previousBracket { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
previousBracket: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | 310 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 310 | my $place = $self->thisBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | 310 | my @indexOrder = $self->bracketOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | 310 | my $previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | 310 | for my $index ( @indexOrder ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | 1108 | ▶ | last if $index eq $place; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 798 | $previousBracket = $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 310 | return $previousBracket; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | =head2 index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | $pairing->index($bracket) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | Gets the index of $bracket, possibly a changing label, because remainder groups coming into being and are given virtual bracket status. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | 22 | ▶ | sub index { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | 22 | my $brackets = $self->brackets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | 22 | my $bracket = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | 22 | my $score = $bracket->score; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | 22 | my $number = $bracket->number; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 22 | my @order = $self->bracketOrder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | 78 | ▶ | my $index = first { m/^\d+(\.5)?$/ and $brackets->{$_}->score==$score } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | 22 | @order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | 22 | ▶ | confess "No index for Bracket $number, with score $score. Is it dissolved?" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | unless defined $index; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | # $index .= 'C11Repair' if $bracket->{c11repairof}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | # $index .= 'C10Repair' if $bracket->{c10repairof}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | 22 | ▶ | $index .= 'Remainder' if $bracket->{remainderof}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | 22 | return $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | =head2 round | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | $pairing->round | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | What round is this round's results we're pairing on the basis of? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 523 | ▶ | sub round { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
round: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 523 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 523 | my $round = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 0 | ▶ | if ( defined $round ) { $self->{round} = $round; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | 523 | elsif ( $self->{round} ) { return $self->{round}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | =head2 thisBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | $pairing->thisBracket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | $pairing->thisBracket($pairing->firstBracket) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | What bracket is this? Gets/sets a string of the form $score, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | ${score}Remainder if it is a remainder group. (In C10, create an 'C10Repair' group.) You need to set this when moving from one bracket to another. And test the value returned. If no bracket is set, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | 8812 | ▶ | sub thisBracket { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
thisBracket: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 8812 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 8812 | my $thisBracket = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | 8812 | ▶ | if ( defined $thisBracket ) { $self->{thisBracket} = $thisBracket; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | 8343 | elsif ( defined $self->{thisBracket} ) { return $self->{thisBracket}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | 469 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | =head2 byer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | $group->byer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | Gets/sets the player set to take the bye. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | 60 | ▶ | sub byer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
byer: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | 60 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | 60 | my $byer = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | 60 | ▶ | if ( defined $byer ) { $self->{byer} = $byer; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | 30 | elsif ( $self->{byer} ) { return $self->{byer}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | 30 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | =head2 paired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | $group->paired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | Gets/sets an array of paired players, arranged pair by pair, in the bracket being paired. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | 0 | ▶ | sub paired { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
paired: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | 0 | my $paired = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | 0 | ▶ | if ( defined $paired ) { $self->{paired} = $paired; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | 0 | elsif ( $self->{paired} ) { return $self->{paired}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | =head2 nonpaired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | $group->nonpaired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | Gets/sets an array of nonpaired players in the bracket being paired. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | 296 | ▶ | sub nonpaired { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpaired: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | 296 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | 296 | my $nonpaired = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | 296 | ▶ | if ( defined $nonpaired ) { $self->{nonpaired} = $nonpaired; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | 148 | elsif ( $self->{nonpaired} ) { return $self->{nonpaired}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | 148 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | =head2 matches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | $group->matches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | Gets/sets the matches which we have made. Returned is an anonymous hash of the matches in the round, keyed on a bracket index. Each value of the hash is an anonymous array of the matches in that bracket. So to get each actual match, you need to break up the matches in the individual brackets. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | 335 | ▶ | sub matches { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
matches: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | 335 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | 335 | my $matches = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | 0 | ▶ | if ( defined $matches ) { $self->{matches} = $matches; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | 335 | elsif ( $self->{matches} ) { return $self->{matches}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | =head2 whoPlayedWho | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | $group->whoPlayedWho | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | Gets/sets a anonymous hash, keyed on the pairing numbers of the opponents, of the preference of individual pairs of @grandmasters, if they both have the same absolute preference, and so can't play each other. This has probably been calculated by Games::Tournament::Swiss::whoPlayedWho B1a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | 1772 | ▶ | sub whoPlayedWho { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
whoPlayedWho: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | 1772 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | 1772 | my $whoPlayedWho = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | 0 | ▶ | if ( defined $whoPlayedWho ) { $self->{whoPlayedWho} = $whoPlayedWho; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | 1722 | elsif ( $self->{whoPlayedWho} ) { return $self->{whoPlayedWho}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | =head2 colorClashes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | $group->colorClashes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | Gets/sets a anonymous hash, keyed on the pairing numbers of the opponents, of their preference, if (and only if) they both have an Absolute preference for the same role and so can't play each other. This has probably been calculated by Games::Tournament::Swiss::colorClashes B2a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | 1772 | ▶ | sub colorClashes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
colorClashes: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | 1772 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | 1772 | my $colorClashes = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | 0 | ▶ | if ( defined $colorClashes ) { $self->{colorClashes} = $colorClashes; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | 1260 | elsif ( $self->{colorClashes} ) { return $self->{colorClashes}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | =head2 incompatibles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | $group->incompatibles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | Gets/sets a anonymous hash, keyed on the pairing numbers of the opponents, of a previous round in which individual pairs of @grandmasters, if any, met. Or of their preference if they both have an Absolute preference for the same role and can't play each other. This has probably been calculated by Games::Tournament::Swiss::incompatibles. B1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | 0 | ▶ | sub incompatibles { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
incompatibles: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | 0 | my $incompatibles = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | 0 | ▶ | if ( defined $incompatibles ) { $self->{incompatibles} = $incompatibles; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 0 | elsif ( $self->{incompatibles} ) { return $self->{incompatibles}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | =head2 byes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | $group->byes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | return BYE unless $group->byes->{$id} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | Gets/sets a anonymous hash, keyed on ids, not pairing numbers of players, of a previous round in which these players had a bye. This has probably been calculated by Games::Tournament::Swiss::byes. B1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | 62 | ▶ | sub byes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
byes: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | 62 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | 62 | my $byes = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 0 | ▶ | if ( defined $byes ) { $self->{byes} = $byes; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | 62 | elsif ( $self->{byes} ) { return $self->{byes}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | =head2 penultpPrime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | $pairing->penultpPrime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | $pairing->penultpPrime($previousBracket->pprime) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | Gets/sets an accessor to the number of pairs in the penultimate bracket. When this reaches 0, the penultimate and final brackets are joined. C14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | 58 | ▶ | sub penultpPrime { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
penultpPrime: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | 58 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | 58 | my $penultpPrime = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | 58 | ▶ | if ( defined $penultpPrime ) { $self->{penultpPrime} = $penultpPrime; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | 0 | elsif ( $self->{penultpPrime} ) { return $self->{penultpPrime}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | 58 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | =head2 floatCriteriaInForce | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | $group->floatCriteriaInForce( $group->floatCheckWaive ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | Given the last criterion at which level checks have been waived, returns an anonymous array of the levels below this level for which checking is still in force. B5,6 C6,9,10 TODO All is nice, but creates problems. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | 274 | ▶ | sub floatCriteriaInForce { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
floatCriteriaInForce: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | 274 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | 274 | my $level = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 274 | my @levels = qw/None B6Down B5Down B6Up B5Up All None/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | 274 | my $oldLevel = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | 274 | ▶ | $oldLevel = shift @levels until $oldLevel eq $level; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | 274 | return \@levels; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | Dr Bean, C<< <drbean, followed by the at mark (@), cpan, then a dot, and finally, org> >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | Please report any bugs or feature requests to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | C<bug-games-tournament-swiss at rt.cpan.org>, or through the web interface at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Tournament-Swiss>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | your bug as I make changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | perldoc Games::Tournament::Swiss | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | L<http://annocpan.org/dist/Games-Tournament-Swiss> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | L<http://cpanratings.perl.org/d/Games-Tournament-Swiss> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Games-Tournament-Swiss> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | L<http://search.cpan.org/dist/Games-Tournament-Swiss> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | See L<http://www.fide.com/official/handbook.asp?level=C04> for the FIDE's Swiss rules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | Copyright 2006 Dr Bean, all rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | 25 | 1; # End of Games::Tournament::Swiss::Procedure | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | # vim: set ts=8 sts=4 sw=4 noet: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||