Skip Menu |

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

Report information
The Basics
Id: 29485
Status: resolved
Priority: 0/
Queue: Games-Tournament-Swiss

People
Owner: Nobody in particular
Requestors: bartolin [...] gmx.de
Cc:
AdminCc:

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



Subject: pairingtable, pairtable2yaml, pair with odd number of players
Date: Wed, 19 Sep 2007 10:44:00 +0200
To: bug-Games-Tournament-Swiss [...] rt.cpan.org
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, it seems to me that the sequenze 'pairingtable' -> 'pairtable2yaml' -> 'pair' doesn't work when there is an odd number of players. Let's assume, we have five players, which are paired in the first round: 3-1 result: Draw 2-4 result: Draw 5 Bye Running 'pairingtable' on gets (correctely): Show quoted text
> Round 2 Pairing Groups > ------------------------------------------------------------ > Place No Opponents Roles Float Score > 1 > 5 - - D 1 > 2-5 > 1 4 W 0.5 > 2 3 B 0.5 > 3 2 W 0.5 > 4 1 B 0.5
Now using 'pairtable2yaml' to generate pairtable.yaml, the script seems to ignore player 5: Show quoted text
> --- > floats: > 1: > - ~ > - ~ > 2: > - ~ > - ~ > 3: > - ~ > - ~ > 4: > - ~ > - ~ > opponents: > 1: > - 4 > 2: > - 3 > 3: > - 2 > 4: > - 1 > roles: > 1: > - White > 2: > - Black > 3: > - White > 4: > - Black > score: > 1: 0.5 > 2: 0.5 > 3: 0.5 > 4: 0.5
Running 'pair', it complains about bad opponent for player 5: Show quoted text
> Use of uninitialized value in hash element at pair line 107. > Use of uninitialized value in numeric ne (!=) at pair line 107. > Use of uninitialized value in concatenation (.) or string at pair line 107. > Use of uninitialized value in concatenation (.) or string at pair line 107. > Player 5's opponent is , but 's opponent isn't 5 at pair line 107.
Everything works fine when I use 'pairstately' instead of those sequence. Therefore I use 'pairstately' again for my web frontend again. But I thought, I could report this problem, nevertheless. Best regards Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29485] pairingtable, pairtable2yaml, pair with odd number of players
Date: Wed, 19 Sep 2007 11:27:07 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Wed, 19 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> it seems to me that the sequenze 'pairingtable' -> 'pairtable2yaml' -> > 'pair' doesn't work when there is an odd number of players.
I can reproduce this with the 0.08 version. I don't know why it is happening. It was probably due to '-' not being accepted in roles. I have been working on the grammar. The latest version appear to be OK. === pairtable2yaml ================================================================== --- pairtable2yaml (revision 1373) +++ pairtable2yaml (revision 1381) @@ -20,6 +20,7 @@ use IO::All; use Parse::RecDescent; our $RD_HINT=1; +use List::MoreUtils qw/firstval/; my $io = io $ARGV[0]; my @lines = $io->slurp; @@ -29,7 +30,7 @@ for my $line ( @lines ) { - our ($player, $opponents, $roles, $floats, $score, $result); + our ($player, $opponents, $roles, $b5float, $b6float, $score, $result); my $format = q{ line: data end | longform end | comment end | <error> data: player opponents roles floats score @@ -38,16 +39,35 @@ player: id { $::player = $item[1] } id: wholenumber wholenumber: m/^\d+/ + Bye: '-' opponents: opponent(s /,/) { $::opponents = $item[1] } - opponent: id | '-' + opponent: id | Bye roles: role(s) { $::roles = $item[1] } - role: White | Black + role: White | Black | Bye White: 'W' Black: 'B' - floats: B6float(?) B5float(?) - { push @$::floats, $item[1]->[0], $item[2]->[0] } - B6float: 'u' | 'd' - B5float: 'U' | 'D' + floats: B6andB5 | B5andB6 | B5float | B6float | NotFloat + B6andB5: B6float B5float + { + $::b5float ||= $item{'B5float'}; + $::b6float ||= $item{'B6float'}; + } + B5andB6: B5float B6float + { + $::b5float ||= $item{'B5float'}; + $::b6float ||= $item{'B6float'}; + } + B6float: lowercasefloat + { + $::b6float ||= $item{'lowercasefloat'}; + } + lowercasefloat: 'u' | 'd' + B5float: uppercasefloat + { + $::b5float ||= $item{'uppercasefloat'}; + } + uppercasefloat: 'U' | 'D' + NotFloat: '' score: scorenumber { $::score = $item[1] } scorenumber: m/^\d+(?:\.5)?/ comment: token(s?) {$::result = 'comment'} @@ -59,22 +79,28 @@ defined $parser->line($line) or die "parser died: $?\n"; unless ( $result and $result eq 'comment' ) { + for ( @$opponents ) + { + $_ = 'Bye' if $_ and $_ eq '-'; + } $table->{opponents}->{$player} = $opponents; for ( @$roles ) { $_ = 'White' if $_ and $_ eq 'W'; $_ = 'Black' if $_ and $_ eq 'B'; + $_ = 'Bye' if $_ and $_ eq '-'; } - for ( @$floats ) + $table->{roles}->{$player} = $roles; + for ( $b5float, $b6float ) { $_ = 'Up' if $_ and $_ =~ m/^U$/i; $_ = 'Down' if $_ and $_ =~ m/^D$/i; + $_ = 'Not' unless $_; } - $table->{roles}->{$player} = $roles; - $table->{floats}->{$player} = $floats; + $table->{floats}->{$player} = [ $b6float, $b5float ]; $table->{score}->{$player} = $score; } - ($::player, $::opponents, $::roles, $::floats, $::score, $::result) = undef; + ($::player, $::opponents, $::roles, $::b5float, $::b6float, $::score, $::result) = undef; } DumpFile 'pairtable.yaml', $table;
Probably fixed in or before r1381