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.