Skip Menu |

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


Subject: Inconvenience with 0.10: games not ordered correctly
Date: Fri, 12 Oct 2007 19:12:29 +0200
To: bug-Games-Tournament-Swiss [...] rt.cpan.org
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, I found a minor inconvenience with version 0.10: While using 'pair' or 'pairstately' the games (e.g. the array @games) are no longer in the right order. That becames obvious when one looks at the newly created 'round.yaml' after running 'pair' or 'pairstately' for rounds > 1. This has no impact on the pairings, one just has to figure out the correct order. Best regards Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

This is a result of the matches being grouped by bracket. The order the brackets comes out is unsorted. I did something about the order, in version 0.11, which I just uploaded, but it still leaves the Bye at the head of the list at Table 1. What if the matches were left grouped by bracket? That would be easier, but I think users want to see just the pairings. I think they're not interested in what bracket the pairings are for. It just makes it harder to search for names.
Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sat, 13 Oct 2007 10:38:50 +0200
To: Dr Bean via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-10-13 Dr Bean via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=29953 > > > This is a result of the matches being grouped by bracket. The order > the brackets comes out is unsorted. I did something about the order, > in version 0.11, which I just uploaded, but it still leaves the Bye > at the head of the list at Table 1.
Apart from this, there seem to be problems left with the sorting. Try the following pairing table: Round 2 Pairing Groups -------------------------------------------------------------- Place No Opponents Roles Float Score 1-9 2 12 B 1 3 13 W 1 4 14 B 1 5 15 W 1 6 16 B 1 7 17 W 1 8 18 B 1 9 19 W 1 10 20 B 1 10-11 1 11 W 0.5 11 1 B 0.5 12-20 12 2 W 0 13 3 B 0 14 4 W 0 15 5 B 0 16 6 W 0 17 7 B 0 18 8 W 0 19 9 B 0 20 10 W 0 Player 1 (with 0.5 points) is paired on board 9 (instead of board 5) and player 11 (also with 0.5 points) is paired on board 10 (instead of board 6). Further down the road (in later rounds) there are similar problems. Show quoted text
> What if the matches were left grouped by bracket? That would be > easier, but I think users want to see just the pairings. I think > they're not interested in what bracket the pairings are for. It just > makes it harder to search for names.
I agree that it would be better to have the plain pairings without any further grouping.
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sat, 12 Jul 2008 00:25:41 +0200
To: Dr Bean via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Hi, after a long time I just came back to Games::Tournament::Swiss. I still want to improve my prototype of a web frontend for your module Games::Tournament::Swiss. I took a closer look at the problem of wrongly ordered games (described at http://rt.cpan.org/Ticket/Display.html?id=29953). * On 2007-10-13 Dr Bean via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...] > This is a result of the matches being grouped by bracket. The order > the brackets comes out is unsorted. I did something about the order, > in version 0.11, which I just uploaded, but it still leaves the Bye > at the head of the list at Table 1.
As you wrote, it has to do with the matches being grouped by bracket. I used your script 'pairstately' from version 0.15 and got a strange order of matches again. The script says in line 166 to 171: 166 for my $bracket ( reverse sort keys %$matches ) 167 { 168 my $bracketmatches = $matches->{$bracket}; 169 push @games, grep { $_ if ref eq 'Games::Tournament::Card' } 170 @$bracketmatches; 171 } Unfortunately the keys of %$matches look like: 2.5 2.5Remainder 2 2Remainder 1.5 And so on ... The sort in line 166 can't order those keys correctly. Maybe it's best to find better (sortable) names for the keys in FIDE.pm? But I don't have a good idea for that. As a workaround I tried to modify the sort function in line 166 of 'pairstately' as you can see in the attached diff. It's certainly a dirty hack but it seems to work for me. The diff was generated with $> diff -up pairstately_0.15.orig pairstately > diff_pairstately Best regards Christian

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Mon, 14 Jul 2008 09:36:04 +0200
To: Dr Bean via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Hi, * On 2008-07-12 Christian Bartolomaeus (bartolin@gmx.de) wrote: Show quoted text
> [...]
> > This is a result of the matches being grouped by bracket. The order > > the brackets comes out is unsorted. I did something about the order, > > in version 0.11, which I just uploaded, but it still leaves the Bye > > at the head of the list at Table 1.
> > And so on ... The sort in line 166 can't order those keys correctly. > Maybe it's best to find better (sortable) names for the keys > in FIDE.pm? But I don't have a good idea for that. > > As a workaround I tried to modify the sort function in line 166 of > 'pairstately' as you can see in the attached diff. It's certainly a > dirty hack but it seems to work for me.
I forgot to include "Byes" in my modified sort function, so they ended at top still. I modified my sort function further and generated a new diff against the unmodified script 'pairstately' from version 0.15 (see attachment). The diff was generated with $> diff -up pairstately_0.15.orig pairstately > diff_pairstately Best regards Christian

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sat, 19 Jul 2008 13:52:56 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Mon, 14 Jul 2008, Christian Bartolomaeus via RT wrote: Show quoted text
> > And so on ... The sort in line 166 can't order those keys correctly.
Show quoted text
> > As a workaround I tried to modify the sort function in line 166 of > > 'pairstately' as you can see in the attached diff. It's certainly a > > dirty hack but it seems to work for me.
If it's worthwhile, it doesn't matter if it's not clean. Show quoted text
> $> diff -up pairstately_0.15.orig pairstately > diff_pairstately
Show quoted text
> --- /usr/local/bin/pairstately_0.15.orig 2008-07-11 20:43:58.000000000 +0200 > +++ /usr/local/bin/pairstately 2008-07-14 09:33:45.000000000 +0200 > @@ -163,7 +163,46 @@ my $paired = $pairing->matchPlayers; > my $matches = $paired->{matches}; > my @games;
Show quoted text
> -for my $bracket ( reverse sort keys %$matches ) > +## dirty hack to get the order of matches right (added by CB 2008-07-11) > +## keys from %$matches are named "2.5", "2", "2Remainder", "0Bye" and so on > +# for my $bracket ( reverse sort keys %$matches ) > +for my $bracket ( reverse sort { > + if ( $a =~ /Bye$/ ) { > + return -1; > + } > + elsif ( $b =~ /Bye$/ ) { > + return 1; > + } > + elsif ( $a =~ /^(\d+\.?5?)Remainder$/ ) { > + if ( $1 eq $b ) { > + return -1; > + } > + else { > + my $numbers_a = $1; > + if ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > + return $numbers_a cmp $1;
Shouldn't it be return $numbers_a <=> $1; 10 is lexicographically less than 9. I would also prefer (\d+\.?\d?) for the non-chess users who might be giving some othe rscore for a draw. Show quoted text
> + } > + else { > + return $numbers_a cmp $b; > + } > + } > + } > + elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > + if ( $1 eq $a ) { > + return 1; > + } > + else { > + my $numbers_b = $1; > + if ( $a =~ /^(\d+\.?5?)Remainder$/ ) { > + return $1 cmp $numbers_b; > + }
Doesn't this perform the same test as the code before my comment? This may not be reason enough to remove it. It might make it easier to see what the whole sort block is doing. Show quoted text
> + else { > + return $a cmp $numbers_b; > + } > + } > + } > + else { return $a cmp $b; } > + } keys %$matches ) > { > my $bracketmatches = $matches->{$bracket}; > push @games, grep { $_ if ref eq 'Games::Tournament::Card' }
Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Mon, 21 Jul 2008 13:28:04 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

* On 2008-07-19 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=29953 > > [...]
> > $> diff -up pairstately_0.15.orig pairstately > diff_pairstately
>
> > --- /usr/local/bin/pairstately_0.15.orig 2008-07-11 20:43:58.000000000 +0200 > > +++ /usr/local/bin/pairstately 2008-07-14 09:33:45.000000000 +0200 > > @@ -163,7 +163,46 @@ my $paired = $pairing->matchPlayers; > > my $matches = $paired->{matches}; > > my @games;
>
> > -for my $bracket ( reverse sort keys %$matches ) > > +## dirty hack to get the order of matches right (added by CB 2008-07-11) > > +## keys from %$matches are named "2.5", "2", "2Remainder", "0Bye" and so on > > +# for my $bracket ( reverse sort keys %$matches ) > > +for my $bracket ( reverse sort { > > + if ( $a =~ /Bye$/ ) { > > + return -1; > > + } > > + elsif ( $b =~ /Bye$/ ) { > > + return 1; > > + } > > + elsif ( $a =~ /^(\d+\.?5?)Remainder$/ ) { > > + if ( $1 eq $b ) { > > + return -1; > > + } > > + else { > > + my $numbers_a = $1; > > + if ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > > + return $numbers_a cmp $1;
> > Shouldn't it be > return $numbers_a <=> $1; > > 10 is lexicographically less than 9.
Oops, you're right. Further down the block I made the same error a few times. So I think all "cmp" should be replaced with "<=>". Show quoted text
> I would also prefer (\d+\.?\d?) for the non-chess > users who might be giving some othe rscore for a > draw.
That sounds sensible. Show quoted text
> > + } > > + else { > > + return $numbers_a cmp $b; > > + } > > + } > > + } > > + elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > > + if ( $1 eq $a ) { > > + return 1; > > + } > > + else { > > + my $numbers_b = $1; > > + if ( $a =~ /^(\d+\.?5?)Remainder$/ ) { > > + return $1 cmp $numbers_b; > > + }
> Doesn't this perform the same test as the code before my comment? > This may not be reason enough to remove it. It might make > it easier to see what the whole sort block is doing.
Since I'm manually defining what to do (return 1 or -1 or compare some values with "cmp" (better "<=>")), I thought I have to take care of both $a and $b seperately. Take a look at the small attached program which tries to sort two different lists of bracket groups with two different sort_bracket() functions. If I omit that last else { } you asked about (sort_bracket2() in the program), the second list isn't sorted correctly. (Note that the first list is ordered correctly, so the initial order of the list matters.) Or did you referred to another part of the block? It looks to me as I couldn't omit something without getting wrong results. Best regards Christian

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Mon, 21 Jul 2008 13:48:19 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Sorry for sending a second reply, but I hit my send key to early. * On 2008-07-19 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...]
> > > As a workaround I tried to modify the sort function in line 166 of > > > 'pairstately' as you can see in the attached diff. It's certainly a > > > dirty hack but it seems to work for me.
> > If it's worthwhile, it doesn't matter if it's not clean.
I think it would be good to provide a way to sort brackets with Games::Tournament::Swiss. At the moment the brackets come out as a hash reference $matches = $paired->{matches}; with keys like "1.5 1.5Remainder 1 1Remainder 1Bye" from $paired = $pairing->matchPlayers; Maybe we could have a method @brackets = $matches->sort_brackets which returns a sorted list of hash references of our brackets -- thereby using something like the sort mechanism we discussed in this thread? That way it would be easier to access the computed pairings from a script. 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 #29953] Inconvenience with 0.10: games not ordered correctly
Date: Wed, 23 Jul 2008 14:22:34 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Mon, 21 Jul 2008, Christian Bartolomaeus via RT wrote: Show quoted text
> Take a look at the small attached program which tries to sort two > different lists of bracket groups with two different sort_bracket() > functions. If I omit that last else { } you asked about > (sort_bracket2() in the program), the second list isn't sorted > correctly. (Note that the first list is ordered correctly, so the > initial order of the list matters.)
That's true. On the other hand, if instead of Show quoted text
> elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > if ( $1 eq $a ) { > return 1; > } > }
you have elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { return $a <=> $1; } I think it does sort the 2 lists correctly, because $a is just a number, not a number plus a string. If it was a number plus string, it would be handled by the elsif conditional before. Thinking about it, is it perhaps better to keep the "Remainder" tag out of the name? Is there some other way of naming the groups?
Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Wed, 23 Jul 2008 14:22:34 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Mon, 21 Jul 2008, Christian Bartolomaeus via RT wrote: Show quoted text
> Take a look at the small attached program which tries to sort two > different lists of bracket groups with two different sort_bracket() > functions. If I omit that last else { } you asked about > (sort_bracket2() in the program), the second list isn't sorted > correctly. (Note that the first list is ordered correctly, so the > initial order of the list matters.)
That's true. On the other hand, if instead of Show quoted text
> elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > if ( $1 eq $a ) { > return 1; > } > }
you have elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { return $a <=> $1; } I think it does sort the 2 lists correctly, because $a is just a number, not a number plus a string. If it was a number plus string, it would be handled by the elsif conditional before. Thinking about it, is it perhaps better to keep the "Remainder" tag out of the name? Is there some other way of naming the groups?
Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sun, 27 Jul 2008 19:46:59 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2008-07-23 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=29953 > > > On Mon, 21 Jul 2008, Christian Bartolomaeus via RT wrote: >
> > Take a look at the small attached program which tries to sort two > > different lists of bracket groups with two different sort_bracket() > > functions. If I omit that last else { } you asked about > > (sort_bracket2() in the program), the second list isn't sorted > > correctly. (Note that the first list is ordered correctly, so the > > initial order of the list matters.)
> > That's true. On the other hand, if instead of >
> > elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > > if ( $1 eq $a ) { > > return 1; > > } > > }
> > you have > > elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > return $a <=> $1; > } > > I think it does sort the 2 lists correctly, because $a is just a > number, not a number plus a string. If it was a number plus string, > it would be handled by the elsif conditional before.
Ahh, I see. Indeed I don't have to test whether $a is something else than a number. But your code would fail if for instance ($a eq 1) and ($b eq '1Remainder') since it would test $a <=> $1 which is the wrong thing to do. Instead we have to return 1 for this case. So I think a correct code for the last elsif is: elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { if ( $1 eq $a ) { return 1; } else { return $a <=> $1; } } } Show quoted text
> Thinking about it, is it perhaps better to keep the "Remainder" tag > out of the name? > > Is there some other way of naming the groups?
I thought about that but didn't have a good idea. What about naming groups Group_<numberofgroup>_<points>[<Remainder|Bye>] where <numberofgroup> is an integer which indicates the "position" of that group in a sorted list. To give an example: If we have the groups (old names) 1.5 1.5Remainder 1 1Remainder 1Bye we would call them Group_1_1.5 Group_2_1.5Remainder Group_3_1 Group_4_1Remainder Group_5_1Bye That way it would be easier to sort the groups if needed, since one could sort them numerically after matching for /_(\d+)_/. But this approach looks a bit clumsy. 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 #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sat, 23 Aug 2008 07:49:40 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Sun, 27 Jul 2008, Christian Bartolomaeus via RT wrote: Show quoted text
> Queue: Games-Tournament-Swiss > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=29953 >
Show quoted text
> So I think a correct code for the last elsif is:
Show quoted text
> elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > if ( $1 eq $a ) { > return 1; > } > else { > return $a <=> $1; > } > }
Sorry, I didn't look at this. I've been trying to implement a permuation subroutine to check if all possible orderings of a set of groups are ordered correctly (by some arbitrary sort routine). I gave up and used one from Higher Order Perl. It confirms your original sort routine is OK. But I just found out the brackets are sorted by the bracketOrder method in FIDE.pm. I wonder why that doesn't result in ordered pairings. Look at the output of the attached sort.pl. (My sort routine is putting the Bye player in the wrong place.) Perhaps bracketOrder has to be moved out into Games:Tournament::Swiss. Show quoted text
> > Thinking about it, is it perhaps better to keep the "Remainder" tag > > out of the name?
Show quoted text
> > Is there some other way of naming the groups?
Show quoted text
> I thought about that but didn't have a good idea. What about naming > groups
Show quoted text
> Group_<numberofgroup>_<points>[<Remainder|Bye>]
Show quoted text
> where <numberofgroup> is an integer which indicates the "position" of > that group in a sorted list.
Show quoted text
> To give an example: If we have the groups (old names)
Show quoted text
> 1.5 > 1.5Remainder > 1 > 1Remainder > 1Bye
Show quoted text
> we would call them
Show quoted text
> Group_1_1.5 > Group_2_1.5Remainder > Group_3_1 > Group_4_1Remainder > Group_5_1Bye
Show quoted text
> That way it would be easier to sort the groups if needed, since one > could sort them numerically after matching for /_(\d+)_/.
Show quoted text
> But this approach looks a bit clumsy.
I think the underscore is better, but I'm moving to the position that all the user interested in is the order of the groups. That's why the idea of a name for a group is not discussed in the FIDE Rules. So a simple number from 1 up to the total number of groups, which includes all the remainder groups and players with byes is better, I think. But that means we have to refactor the naming being done in FIDE.pm.

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sat, 23 Aug 2008 22:33:35 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2008-08-23 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=29953 > >
> > So I think a correct code for the last elsif is:
>
> > elsif ( $b =~ /^(\d+\.?5?)Remainder$/ ) { > > if ( $1 eq $a ) { > > return 1; > > } > > else { > > return $a <=> $1; > > } > > }
> > Sorry, I didn't look at this. I've been trying to implement a > permuation subroutine to check if all possible orderings of a set > of groups are ordered correctly (by some arbitrary sort routine). > > I gave up and used one from Higher Order Perl. It confirms your > original sort routine is OK. > > But I just found out the brackets are sorted by the bracketOrder > method in FIDE.pm. I wonder why that doesn't result in ordered > pairings.
I think the bracketOrder method isn't used in your 'pairstately' script. (That's where I first stumbled over the wrong sorting.) There (line 166) we just have a hash ref $matches and try to sort its keys with for my $bracket ( reverse sort keys %$matches ) { ... } Show quoted text
> Look at the output of the attached sort.pl. (My sort routine is > putting the Bye player in the wrong place.)
I see. So there was a bug in FIDE.pm all the time and not only in 'pairstately'? Until recently I never tested Games::Tournament::Swiss with an odd number of players -- so there was no Bye group ... Show quoted text
> Perhaps bracketOrder has to be moved out into > Games:Tournament::Swiss.
Since bracketOrder is useful for ordering the pairing after they are generated (e.g. by FIDE.pm), to me it sounds sensible to move them into Games::Tournament::Swiss. Show quoted text
> > > Thinking about it, is it perhaps better to keep the "Remainder" tag > > > out of the name?
>
> > > Is there some other way of naming the groups?
>
> > I thought about that but didn't have a good idea. What about naming > > groups
>
> > Group_<numberofgroup>_<points>[<Remainder|Bye>]
>
> > where <numberofgroup> is an integer which indicates the "position" of > > that group in a sorted list.
>
> > To give an example: If we have the groups (old names)
>
> > 1.5 > > 1.5Remainder > > 1 > > 1Remainder > > 1Bye
>
> > we would call them
>
> > Group_1_1.5 > > Group_2_1.5Remainder > > Group_3_1 > > Group_4_1Remainder > > Group_5_1Bye
>
> > That way it would be easier to sort the groups if needed, since one > > could sort them numerically after matching for /_(\d+)_/.
>
> > But this approach looks a bit clumsy.
> > I think the underscore is better, but I'm moving to the position > that all the user interested in is the order of the groups. > That's why the idea of a name for a group is not discussed in the FIDE Rules. > > So a simple number from 1 up to the total number of groups, which > includes all the remainder groups and players with byes is better, I > think.
That sounds good to me, too. (Tough I must say that (after I understood the scheme) I liked the verbal group names -- they where useful for creating a test from a real tournament, since it was relatively easy to get the right group from looking at the pairings. E.g. PlayerA (5) -- PlayerB (4.5) -> both players in 4.5 PlayerC (4.5) -- PlayerD (4.5) -> both players in 4.5 PlayerE (4.5) -- PlayerF (4) -> both players in 4 PlayerG (4) -- PlayerH (4) -> both players in 4Remainder ... Show quoted text
> But that means we have to refactor the naming being done in > FIDE.pm.
Well, I guess that's some work to do. So maybe it's easier to stay with the current naming scheme and provide a new/updated method for sorting brackets? 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 #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sun, 24 Aug 2008 11:38:10 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Sat, 23 Aug 2008, Christian Bartolomaeus via RT wrote: Show quoted text
> > But I just found out the brackets are sorted by the bracketOrder > > method in FIDE.pm. I wonder why that doesn't result in ordered > > pairings.
Show quoted text
> I think the bracketOrder method isn't used in your 'pairstately' > script. (That's where I first stumbled over the wrong sorting.) There > (line 166) we just have a hash ref $matches and try to sort its keys > with
Show quoted text
> for my $bracket ( reverse sort keys %$matches ) { > ... > }
The matchPlayers call before that is running the FIDE algorithm and returning the FIDE object, which is storing the pairings as a hash reference in matches, I think. But we don't need this object. And rather than return the pairings as a hash, if we store and return an array ref, it should be sorted already, perhaps. Show quoted text
> > Look at the output of the attached sort.pl. (My sort routine is > > putting the Bye player in the wrong place.)
Show quoted text
> I see. So there was a bug in FIDE.pm all the time and not only in > 'pairstately'? Until recently I never tested Games::Tournament::Swiss > with an odd number of players -- so there was no Bye group ...
The algorithm finds the players with Byes last, so perhaps it is not a problem. Show quoted text
> > Perhaps bracketOrder has to be moved out into > > Games:Tournament::Swiss.
Show quoted text
> Since bracketOrder is useful for ordering the pairing after they are > generated (e.g. by FIDE.pm), to me it sounds sensible to move them > into Games::Tournament::Swiss.
If we can retain the right order after returning it from matchPlayers, perhaps it isn't necessary. Show quoted text
> > So a simple number from 1 up to the total number of groups, which > > includes all the remainder groups and players with byes is better, I > > think.
Show quoted text
> That sounds good to me, too.
Show quoted text
> (Tough I must say that (after I understood the scheme) I liked the > verbal group names -- they where useful for creating a test from a > real tournament, since it was relatively easy to get the right group > from looking at the pairings. E.g.
Show quoted text
> PlayerA (5) -- PlayerB (4.5) -> both players in 4.5 > PlayerC (4.5) -- PlayerD (4.5) -> both players in 4.5 > PlayerE (4.5) -- PlayerF (4) -> both players in 4 > PlayerG (4) -- PlayerH (4) -> both players in 4Remainder > ...
Mmh. Perhaps we need to think more about it. :-) Show quoted text
> > But that means we have to refactor the naming being done in > > FIDE.pm.
Show quoted text
> Well, I guess that's some work to do. So maybe it's easier to stay > with the current naming scheme and provide a new/updated method for > sorting brackets?
Perhaps we can just get matchPlayers to return the pairings above (expressing it in YAML form) as - - - Player A - Player B - - Player C - Player D - - Player E - Player F - - Player G - Player H That is the first element of the array has 2 pairings, and the second and third have one each. Then getting the right order of matches is just a matter of shifting off the first element of the array, though perhaps we have to do that recursively.
Subject: Re: [rt.cpan.org #29953] Inconvenience with 0.10: games not ordered correctly
Date: Sun, 24 Aug 2008 16:06:42 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2008-08-24 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=29953 > > > On Sat, 23 Aug 2008, Christian Bartolomaeus via RT wrote: >
> > > But I just found out the brackets are sorted by the bracketOrder > > > method in FIDE.pm. I wonder why that doesn't result in ordered > > > pairings.
>
> > I think the bracketOrder method isn't used in your 'pairstately' > > script. (That's where I first stumbled over the wrong sorting.) There > > (line 166) we just have a hash ref $matches and try to sort its keys > > with
>
> > for my $bracket ( reverse sort keys %$matches ) { > > ... > > }
> > The matchPlayers call before that is running the FIDE algorithm and > returning the FIDE object, which is storing the pairings as a hash > reference in matches, I think. But we don't need this object. And > rather than return the pairings as a hash, if we store and return an > array ref, it should be sorted already, perhaps.
I remember that I was a bit puzzled about matchPlayers returning the FIDE object -- instead of just the matches. I agree that it would be sufficient to return an (ordered) array of the matches. If my grep command doesn't fool me, the matchPlayers method isn't called from any .pm file in Games::Tournament::Swiss. So a change of that method should only affect the scripts like 'pairstately'. Show quoted text
> > > Look at the output of the attached sort.pl. (My sort routine is > > > putting the Bye player in the wrong place.)
>
> > I see. So there was a bug in FIDE.pm all the time and not only in > > 'pairstately'? Until recently I never tested Games::Tournament::Swiss > > with an odd number of players -- so there was no Bye group ...
> > The algorithm finds the players with Byes last, so perhaps it is > not a problem.
I see. Show quoted text
> > > Perhaps bracketOrder has to be moved out into > > > Games:Tournament::Swiss.
>
> > Since bracketOrder is useful for ordering the pairing after they are > > generated (e.g. by FIDE.pm), to me it sounds sensible to move them > > into Games::Tournament::Swiss.
> > If we can retain the right order after returning it from > matchPlayers, perhaps it isn't necessary.
I agree. Thinking about it some more, I have the impression that it's of no interest to which bracket a match belongs -- after the pairings are determined by FIDE.pm. Show quoted text
> > > So a simple number from 1 up to the total number of groups, which > > > includes all the remainder groups and players with byes is better, I > > > think.
>
> > That sounds good to me, too.
>
> > (Tough I must say that (after I understood the scheme) I liked the > > verbal group names -- they where useful for creating a test from a > > real tournament, since it was relatively easy to get the right group > > from looking at the pairings. E.g.
>
> > PlayerA (5) -- PlayerB (4.5) -> both players in 4.5 > > PlayerC (4.5) -- PlayerD (4.5) -> both players in 4.5 > > PlayerE (4.5) -- PlayerF (4) -> both players in 4 > > PlayerG (4) -- PlayerH (4) -> both players in 4Remainder > > ...
> > Mmh. Perhaps we need to think more about it. :-)
Actually it wasn't to easy to get the right groups: I made a mistake in my example above. It should have been: PlayerA (5) -- PlayerB (4.5) -> both players in 4.5 PlayerC (4.5) -- PlayerD (4.5) -> both players in 4.5Remainder PlayerE (4.5) -- PlayerF (4) -> both players in 4 PlayerG (4) -- PlayerH (4) -> both players in 4Remainder But anyway, except for writing tests I never was interested in the name of groups. So there seems to be nothing wrong with your idea to return an ordered array of matches from matchPlayers. Show quoted text
> > > But that means we have to refactor the naming being done in > > > FIDE.pm.
>
> > Well, I guess that's some work to do. So maybe it's easier to stay > > with the current naming scheme and provide a new/updated method for > > sorting brackets?
> > Perhaps we can just get matchPlayers to return the pairings above > (expressing it in YAML form) as > > - > - > - Player A > - Player B > - > - Player C > - Player D > - > - Player E > - Player F > - > - Player G > - Player H > > That is the first element of the array has 2 pairings, and the > second and third have one each. > > Then getting the right order of matches is just a matter of shifting off the > first element of the array, though perhaps we have to do that > recursively.
But again, what's the advantage of this arrangement over the following? - - Player A - Player B - - Player C - Player D - - Player E - Player F - - Player G - Player H Even for writing tests it should be enough to know that matchPlayers returns an ordered array of matches (or a reference to such an array). Just my two cents. Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

FIDE Rule F1 specifies the ordering of pairs. So, "F1 table ordering implemented in Swiss.pm's orderPairings, executed in publishCards, tested in orderPairings.t" svn diff -r 110:111 http://svn.openfoundry.org/swiss/trunk/lib/Games/Tournament/Swiss.pm