Skip Menu |

This queue is for tickets about the Games-Tournament-Swiss CPAN distribution.

Report information
The Basics
Id: 62502
Status: open
Priority: 0/
Queue: Games-Tournament-Swiss

People
Owner: Nobody in particular
Requestors: vertolet666 [...] yandex.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: c6others issue
Date: Wed, 27 Oct 2010 23:04:45 +0400
To: bug-games-tournament-swiss [...] rt.cpan.org
From: DOBRO Sergei <vertolet666 [...] yandex.ru>
Hi,
 
FIDE.pm's sub c6others doesn't check if the last non-paired player had a Bye before.
I ran into this issue when I had odd number of contestans. One player had a Bye twice.
 
The exact tournament cases were:
- 9 contestans and 5 rounds,
- 11 contestans and 6 rounds.
 
Thanks.
 
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Fri, 29 Oct 2010 03:12:19 +0000
To: Семичёв Сергей via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Wed, 27 Oct 2010, Семичёв Сергей via RT wrote: Show quoted text
> Wed Oct 27 15:04:58 2010: Request 62502 was acted upon. > Transaction: Ticket created by vertolet666@yandex.ru > Queue: Games-Tournament-Swiss > Subject: c6others issue > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: vertolet666@yandex.ru > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=62502 >
Show quoted text
> Hi, FIDE.pm's sub c6others doesn't check if the last non-paired player had a > Bye before.I ran into this issue when I had odd number of contestans. One > player had a Bye twice. The exact tournament cases were:- 9 contestans and 5 > rounds,- 11 contestans and 6 rounds. Thanks.
The code that's supposed to do that is around line 691: my $byeGone = $self->byes->{$id}; unless ( $byeGone) { $self->byer($nonpaired->[0]); return BYE; } $self->log( "B1b: But that player, id $id had Bye in round $byeGone." ); return C13; I guess 'byes' is broken. How are you persisting data over rounds? I wrote a Catalyst front end, at http://svn.openfoundry.org/swiss
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Fri, 29 Oct 2010 14:26:57 +0400
To: bug-games-tournament-swiss [...] rt.cpan.org
From: DOBRO Sergei <vertolet666 [...] yandex.ru>
Thanks for the changes.
Now I'm getting the error:
 
No index for Bracket 3's Remainder Group, with score 1. Is it dissolved? at /usr/lib/perl5/site_perl/5.10.0/Games/Tournament/Swiss/Procedure/FIDE.pm line 1858
        Games::Tournament::Swiss::Procedure::FIDE::index('Games::Tournament::Swiss::Procedure=HASH(0x8c61770)', 'Games::Tournament::Swiss::Bracket=HASH(0x8c76670)') called at /usr/lib/perl5/site_perl/5.10.0/Games/Tournament/Swiss/Procedure/FIDE.pm line 988
        Games::Tournament::Swiss::Procedure::FIDE::c10('Games::Tournament::Swiss::Procedure=HASH(0x8c61770)') called at /usr/lib/perl5/site_perl/5.10.0/Games/Tournament/Swiss/Procedure/FIDE.pm line 137
        Games::Tournament::Swiss::Procedure::FIDE::matchPlayers('Games::Tournament::Swiss::Procedure=HASH(0x8c61770)') called at /test/swiss.pl line 241
 
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Fri, 29 Oct 2010 14:54:55 +0400
To: bug-games-tournament-swiss [...] rt.cpan.org
From: DOBRO Sergei <vertolet666 [...] yandex.ru>
As for persisting data, I'm using YAML::Dump for dumping the result of the previous round which is inserted into PostgreSQL table.
 
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Fri, 29 Oct 2010 15:42:14 +0400
To: bug-games-tournament-swiss [...] rt.cpan.org
From: DOBRO Sergei <vertolet666 [...] yandex.ru>
Let me explain how I'm running into this issue.

The nuber of contestants - 9.
Let us assume their pairing numbers, names and ratings are:
1 - Player1 - 1518
2 - Player2 - 1508
3 - Player3 - 1500
4 - Player4 - 1496
5 - Player5 - 1489
6 - Player6 - 1480
7 - Player7 - 1453
8 - Player8 - 1336
9 - Player9 - 1300

All the ratings given correspond to my conditions.

Round 1. (White - Black -> {result})
------------------------------------------------------------
Player1 - Player5 -> {White => 'Loss', Black => 'Win'},
Player6 - Player2 -> {White => 'Loss', Black => 'Win'},
Player3 - Player7 -> {White => 'Loss', Black => 'Win'},
Player8 - Player4 -> {White => 'Loss', Black => 'Win'},
Player9 -> {Bye => 'Bye'}.
------------------------------------------------------------


Round 2. (White - Black -> {result})
------------------------------------------------------------
Player4 - Player9 -> {White => 'Win', Black => 'Loss'},
Player2 - Player5 -> {White => 'Loss', Black => 'Win'},
Player7 - Player1 -> {White => 'Loss', Black => 'Win'},
Player6 - Player3 -> {White => 'Loss', Black => 'Win'},
Player8 -> {Bye => 'Bye'}.
------------------------------------------------------------


Round 3. (White - Black -> {result})
------------------------------------------------------------
Player5 - Player4 -> {White => 'Loss', Black => 'Win'},
Player1 - Player8 -> {White => 'Loss', Black => 'Win'},
Player3 - Player2 -> {White => 'Loss', Black => 'Win'},
Player9 - Player7 -> {White => 'Loss', Black => 'Win'},
Player6 -> {Bye => 'Bye'}.
------------------------------------------------------------

Round 4. Oops... getting the error described above.

All the pairings was made programmatically with $tourney->pairing().
I've checked out the last version of 'Games-Tournament-Swiss':
svn co http://svn.openfoundry.org/swiss/trunk/

Thanks.
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Fri, 29 Oct 2010 17:05:18 +0400
To: bug-games-tournament-swiss [...] rt.cpan.org
From: DOBRO Sergei <vertolet666 [...] yandex.ru>
Here is the code which repeats this issue.
 
----------------------------------------------------------------------------------------------
#!/usr/bin/perl -w

use Games::Tournament::Swiss::Config;
my $SWISS = Games::Tournament::Swiss::Config->new;
my $SWISS_ROLES = [$SWISS->roles];
my $SWISS_SCORES = { win => 1, loss => 0, draw => 0.5, absent => 0, bye => 1 };
my $SWISS_FIRSTROUND = $SWISS->firstround;
my $SWISS_ALGORITHM = 'Games::Tournament::Swiss::Procedure::FIDE';
my $SWISS_ABBREV = { W => 'White', B => 'Black', 1 => 'Win', 0 => 'Loss', 0.5 => 'Draw', '=' => 'Draw'};

$SWISS->frisk($SWISS_SCORES, $SWISS_ROLES, $SWISS_FIRSTROUND, $SWISS_ALGORITHM, $SWISS_ABBREV);

$Games::Tournament::Swiss::Config::firstround = $SWISS_FIRSTROUND;
%Games::Tournament::Swiss::Config::scores = %$SWISS_SCORES;
@Games::Tournament::Swiss::Config::roles = @$SWISS_ROLES;
$Games::Tournament::Swiss::Config::algorithm = $SWISS_ALGORITHM;

require Games::Tournament::Swiss;
require Games::Tournament::Contestant::Swiss;
require Games::Tournament::Card;

my $players = {
1 => {id => 100, name => 'Player1', rating => 1518},
2 => {id => 200, name => 'Player2', rating => 1508},
3 => {id => 300, name => 'Player3', rating => 1500},
4 => {id => 400, name => 'Player4', rating => 1496}, ### we will watch his games, he must always win!!!
5 => {id => 500, name => 'Player5', rating => 1489},
6 => {id => 600, name => 'Player6', rating => 1480},
7 => {id => 700, name => 'Player7', rating => 1453},
8 => {id => 800, name => 'Player8', rating => 1336},
9 => {id => 900, name => 'Player9', rating => 1300}
};

my $my_player = $players->{4};

my $firstround = $SWISS_FIRSTROUND;
my $tourney;

for my $round (1..4) {
    &go_tourney({round => $round, rounds => 5});
    };

sub go_tourney {
my $r = shift;
my $rounds = $r->{rounds};
my $round = $r->{round};
my @entrants;

if ($round < 2) {
    foreach my $pnum (keys %{$players}) {
        my $c = Games::Tournament::Contestant::Swiss->new(id => $players->{$pnum}->{id}, pairingNumber => $pnum, name => $players->{$pnum}->{name}, rating => $players->{$pnum}->{rating}, score => 0);
        push @entrants, $c;
        undef $c;
        };
    $tourney = Games::Tournament::Swiss->new();
    $tourney->entrants(\@entrants);
    $tourney->round(0);
    $tourney->rounds($rounds);
    $tourney->assignPairingNumbers;
    my @prefplayers = sort {$a->pairingNumber <=> $b->pairingNumber} @{$tourney->entrants};
    my $half =  int(@prefplayers / 2);
    for my $i (0..$#prefplayers) {
        $prefplayers[$i]->preference->difference(0);
        if ($i == $#prefplayers && ($i+1) % 2) {
            $prefplayers[$i]->preference->sign("");
            last;
            };
        if ($i <= $half - 1) {
            my $sign1 = ($i % 2) ? 'White' : 'Black';
            $prefplayers[$i]->preference->sign($sign1);
            }
        else {
            my $sign2 = ($prefplayers[$i - $half]->preference->sign eq 'White') ? 'Black' : 'White';
            $prefplayers[$i]->preference->sign($sign2);
            };
        };
    $tourney->entrants(\@prefplayers);
    };

my %brackets = $tourney->formBrackets;
my $pairing = $tourney->pairing( \%brackets );
my $paired = $pairing->matchPlayers;
my $matches = $paired->{matches};
my @games;

for my $bracket ( reverse sort keys %$matches ) {
    my $bracketmatches = $matches->{$bracket};
    push @games, grep { $_ if ref eq 'Games::Tournament::Card' } @$bracketmatches;
    };

$tourney->round($round);
$tourney->publishCards(@games);

### Playing games
for my $game (@games) {
    if ($game->contestants->{Bye}) {
        $game->result({Bye => "Bye"});
        next;
        };
    my $w = $game->contestants->{White};
    next unless ($w && $w->isa('Games::Tournament::Contestant'));
    my $b = $game->contestants->{Black};
    next unless ($b && $b->isa('Games::Tournament::Contestant'));
    my $white_id = $w->id || next;
    my $black_id = $b->id || next;
    my $result = {};
    ### Checking player's ID
    if ($white_id == $my_player->{id}) {
        $result = {Black => 'Loss', White => 'Win'};
        }
    elsif ($black_id == $my_player->{id}) {
        $result = {Black => 'Win', White => 'Loss'};
        }
    else {
        $result = {Black => 'Win', White => 'Loss'}; ### Black must win otherwise
        };
    $game->result($result);
    };
$tourney->collectCards(@games);

### Updating scores
for my $player (@{$tourney->entrants}) {
    my $score = 0;
    for my $round (keys %{$player->scores}) {
        my $score_val = lc $player->scores->{$round} || "";
        next if (! $score_val);
        $score += $SWISS_SCORES->{$score_val} if (defined $SWISS_SCORES->{$score_val});
        };
    $player->score($score) if ($score);
    };

return 1;
};
 
----------------------------------------------------------------------------------------------
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Sat, 30 Oct 2010 04:11:53 +0000
To: ??????? ?????? via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
I can confirm I'm getting the same error, after the same pairings in rounds 1 to 3. On Fri, 29 Oct 2010, ??????? ?????? via RT wrote: Show quoted text
> Queue: Games-Tournament-Swiss > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=62502 >
Show quoted text
> Let me explain how I'm running into this issue.
Show quoted text
> The nuber of contestants - 9. > Let us assume their pairing numbers, names and ratings are: > 1 - Player1 - 1518 > 2 - Player2 - 1508 > 3 - Player3 - 1500 > 4 - Player4 - 1496 > 5 - Player5 - 1489 > 6 - Player6 - 1480 > 7 - Player7 - 1453 > 8 - Player8 - 1336 > 9 - Player9 - 1300
Show quoted text
> All the ratings given correspond to my conditions.
Show quoted text
> Round 1. (White - Black -> {result}) > ------------------------------------------------------------ > Player1 - Player5 -> {White => 'Loss', Black => 'Win'}, > Player6 - Player2 -> {White => 'Loss', Black => 'Win'}, > Player3 - Player7 -> {White => 'Loss', Black => 'Win'}, > Player8 - Player4 -> {White => 'Loss', Black => 'Win'}, > Player9 -> {Bye => 'Bye'}. > ------------------------------------------------------------
Show quoted text
> Round 2. (White - Black -> {result}) > ------------------------------------------------------------ > Player4 - Player9 -> {White => 'Win', Black => 'Loss'}, > Player2 - Player5 -> {White => 'Loss', Black => 'Win'}, > Player7 - Player1 -> {White => 'Loss', Black => 'Win'}, > Player6 - Player3 -> {White => 'Loss', Black => 'Win'}, > Player8 -> {Bye => 'Bye'}. > ------------------------------------------------------------
Show quoted text
> Round 3. (White - Black -> {result}) > ------------------------------------------------------------ > Player5 - Player4 -> {White => 'Loss', Black => 'Win'}, > Player1 - Player8 -> {White => 'Loss', Black => 'Win'}, > Player3 - Player2 -> {White => 'Loss', Black => 'Win'}, > Player9 - Player7 -> {White => 'Loss', Black => 'Win'}, > Player6 -> {Bye => 'Bye'}. > ------------------------------------------------------------
Show quoted text
> Round 4. Oops... getting the error described above.
Show quoted text
> All the pairings was made programmatically with $tourney->pairing(). > I've checked out the last version of 'Games-Tournament-Swiss': > svn co http://svn.openfoundry.org/swiss/trunk/
Show quoted text
> Thanks.
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Fri, 5 Nov 2010 02:31:25 +0000
To: Семичёв Сергей via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Fri, 29 Oct 2010, Семичёв Сергей via RT wrote: Show quoted text
> Here is the code which repeats this issue.
I wrote a test: svn co http://svn.openfoundry.org/swiss/trunk/t/62502.t But the pairings for Round 4 would be what? Here is a pairing table: Round 4 Pairing Groups ------------------------------------------------- Place No Opponents Roles Float Score 1 4 8,9,5 BWB 3 2-5 2 6,5,3 BWB 2 5 1,2,4 BBW 2 7 3,1,9 BWB 2 8 4,-,1 W-B d 2 6-9 1 5,7,8 WBW 1 3 7,6,2 WBW 1 6 2,3,- WW- D 1 9 -,4,7 -BW 1
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Fri, 5 Nov 2010 03:30:18 +0000
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
I would pair it this way: E4: 2&4 E4: 7&5 8 is downfloating again, but no (other) player should downfloated to comply with B5, according to the Relative Criteria preamble. E2: 8&3 1 must have the Bye because 6 and 9 have already had it: B1. E2: 9&6 Bye: 1
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Mon, 08 Nov 2010 14:20:12 +0300
To: bug-games-tournament-swiss [...] rt.cpan.org
From: DOBRO Sergei <vertolet666 [...] yandex.ru>
I have installed Swiss Master 5.5.
It shows the following pairings for Round 4:
 
Player 4 - Player2
Player7 - Player8
Player5 - Player3
Player9 - Player6
 
Player1 -> bye.
 
 
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Tue, 09 Nov 2010 14:53:14 +0300
To: bug-games-tournament-swiss [...] rt.cpan.org
From: DOBRO Sergei <vertolet666 [...] yandex.ru>
By the way, all the pairings for rounds 1-3 are the same as pairings generated by Swiss Master.
 
Subject: Re: [rt.cpan.org #62502] c6others issue
Date: Wed, 10 Nov 2010 12:22:08 +0000
To: Семичёв Сергей via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
Aaargh. RT changed the ticket number when I changed the Subject: line and left off the bug number in my reply. New number: https://rt.cpan.org/Ticket/Display.html?id=62883