Games-Tournament-Swiss
view release on metacpan or search on metacpan
lib/Games/Tournament/Swiss/Procedure/FIDE.pm view on Meta::CPAN
($s1role, $s2role);
@lastdiff = ($s1role, $s2role);
last;
}
my ( $contestants, $stronger, $diff );
my @roles = map { $_->preference->role } @pair;
my @strengths = map { $_->preference->strength } @pair;
my $rule;
if ( not $roles[0] and not $roles[1] ) {
( $roles[0], $roles[1] ) = $self->randomRole;
$rule = 'No prefs';
}
if ( not $roles[0] ) {
$roles[0] =
( $roles[1] eq (ROLES)[1] )
? (ROLES)[0]
: (ROLES)[1];
$rule = 'No S1 pref';
}
if ( not $roles[1] ) {
$roles[1] =
t/lateentry.t view on Meta::CPAN
my $entries = $tourney->entrants;
+{ map {$_->name => $_->score } @$entries };
}
plan tests => 1 * blocks;
sub RunCheckEnter {
runRound;
my $numbers = next_block;
is_deeply( $numbers->input, $numbers->expected, $numbers->name );
my $prefs = next_block;
is_deeply( $prefs->input, $prefs->expected, $prefs->name );
my $floats = next_block;
is_deeply( $floats->input, $floats->expected, $floats->name );
my $score = next_block;
is_deeply( $score->input, $score->expected, $score->name );
$tourney->enter($late[ shift ]);
}
RunCheckEnter(1);
RunCheckEnter(2);
=head 3 TODO
t/lateentry.t view on Meta::CPAN
=== Round 1 pairingnumbers
--- input chomp numbercheck
0
--- expected yaml
A: 1
a: 2
B: 3
C: 4
D: 5
=== Post-Round 1 prefs
--- input chomp prefcheck
0
--- expected yaml
A: [ Black, Strong ]
a: [ White, Strong ]
B: [ White, Strong ]
C: [ Black, Strong ]
D: [ ~, Mild ]
=== Post-Round 1 floats
t/lateentry.t view on Meta::CPAN
--- input chomp numbercheck
1
--- expected yaml
A: 1
a: 2
B: 3
b: 4
C: 5
D: 6
=== Post-Round 2 prefs
--- input chomp prefcheck
1
--- expected yaml
A: [ White, Mild ]
a: [ Black, Mild ]
B: [ Black, Mild ]
b: [ White, Strong ]
C: [ White, Mild ]
D: [ Black, Strong ]
t/lateentry.t view on Meta::CPAN
2
--- expected yaml
A: 1
a: 2
B: 3
b: 4
C: 5
c: 6
D: 7
=== Post-Round 3 prefs
--- input chomp prefcheck
2
--- expected yaml
A: [ Black, Strong ]
a: [ White, Strong ]
B: [ White, Strong ]
b: [ Black, Mild ]
C: [ Black, Strong ]
c: [ ~, Mild ]
D: [ White, Mild ]
t/lateentry.t view on Meta::CPAN
--- expected yaml
A: 1
a: 2
B: 3
b: 4
C: 5
c: 6
D: 7
d: 8
=== Post-Round 4 prefs
--- input chomp prefcheck
3
--- expected yaml
A: [ White, Mild ]
a: [ Black, Mild ]
B: [ Black, Mild ]
b: [ White, Strong ]
C: [ Black, Absolute ]
c: [ White, Strong ]
D: [ Black, Strong ]
# preference testing at a glance
use lib qw/t lib/;
use strict;
use warnings;
use Test::Base;
use Games::Tournament::Contestant::Swiss::Preference;
filters { input => [ qw/chomp prefseries/ ], expected => [ qw/lines chomp array / ] };
plan tests => 1 * blocks;
use Games::Tournament::Swiss::Config;
my %unabbr = Games::Tournament::Swiss::Config->abbreviation;
$unabbr{'-'} = 'Unpaired';
my %abbr = reverse %unabbr;
$abbr{Unpaired} = 'U';
sub prefseries {
my $play = shift;
$play =~ s/^played: (.*)$/$1/;
my @play = split /\s/, $play;
my @roles = map { $unabbr{$_} || $_ } @play;
my $pref = Games::Tournament::Contestant::Swiss::Preference->new;
my $wants = 'prefer:';
my $degree = 'degree:';
for my $round ( 1 .. @roles )
{
my @oldRoles;
( run in 2.547 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )