Skip Menu |

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

Report information
The Basics
Id: 29184
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: scores aren't recorded properly
Date: Wed, 5 Sep 2007 12:51:19 +0200
To: bug-Games-Tournament-Swiss [...] rt.cpan.org
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, in the thread about C14 in FIDE.pm [1] I noted an error of script "pair", complaining about missing results for players. Show quoted text
> No result in round 1 for player 1, player_1 as White at > /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pair line 126 > No result in round 1 for player 2, player_2 as Black at > /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pair line 126 > [...] > No result in round 1 for player 12, player_12 as White at > /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pair line 126 > No result in round 2 for player 1, player_1 as Black at > /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pair line 126 > No result in round 2 for player 2, player_2 as White at > /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pair line 126 > [...] > No result in round 2 for player 11, player_11 as White at > /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pair line 126 > No result in round 2 for player 12, player_12 as Black at > /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pair line 126
You explained this is related to pair relying on pairing tables nowadays. Show quoted text
> This is a warning about the use of pairing tables. They don't > give the players' individual results in each round. There is only > a total score.
Convincing as this explanation is, I suspect there is another problem related to this one. [But maybe, it's not related.] It seems as if the scores aren't recorded anymore in the yaml files in round subdiretories -- at least they aren't recorded properly. I guess that due to this, "crosstable" and "pairingtable" don't generate correct tables if ($round > 1). If I insert print Dump($player->scores); in crosstable, directely before the table is printed out, it gives values like: 1: ~ 2: Win If I use on old version of yaml files (generated with Games::Tournament::Swiss Version 0.05) those lines read: 1: Win 2: Win This corresponds to (or is caused by) missing values for "scores" in yaml files (like player.yaml). A player.yaml file generated by version 0.07 (pairingtable -> pairtable2yaml -> pair) reads - !!perl/hash:Games::Tournament::Contestant::Swiss floater: Up floats: - ~ - None id: 1 name: 'player_1' oldId: 1 pairingNumber: 1 preference: !!perl/hash:Games::Tournament::Contestant::Swiss::Preference difference: 1 direction: White lastTwo: - White rating: 2200 roles: - White scores: 1: Draw title: ~ while the corresponding lines from a player.yaml file generated with version 0.05 are: - !!perl/hash:Games::Tournament::Contestant::Swiss floater: Up floats: - ~ - Not id: 1 name: 'player_1' oldId: 1 pairingNumber: 1 preference: !!perl/hash:Games::Tournament::Contestant::Swiss::Preference difference: 1 direction: White lastTwo: - White rating: 2200 roles: - White score: 0.5 scores: 1: ~ title: ~ As a result, the method "score" from Contestant.pm seems to be unable to compute the total scores after two or more rounds, and therefor the crosstables and pairingtables aren't correct. I hope my description of the problem was understandable. Best regards, Christian [1] http://rt.cpan.org/Public/Bug/Display.html?id=29073
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sat, 8 Sep 2007 14:54:22 +0200
To: Bugs in Games-Tournament-Swiss via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, Show quoted text
> It seems as if the scores aren't recorded anymore in the yaml files in > round subdiretories -- at least they aren't recorded properly. > > I guess that due to this, "crosstable" and "pairingtable" don't > generate correct tables if ($round > 1).
I found a (really dirty) workaround for my problem. To fix pairingtable (which is more important for me) I inserted the following lines after line 87: $player->{score} += $score{$role}; for my $xxx (@$players) { if ($xxx->{id} eq $player->{id}) { $xxx->{score} = $player->{score}; } } and the following lines after line 131 (counted without the above addition): for my $xxx (@$players) { if ($member->{id} eq $xxx->{id}) { $member->{score} = $xxx->{score}; } } Unfortunately, I'm still not fully understanding how to solve this problem in a clean way. Therefore I saved the correct score for each player to $players and copied it back to $members shortly before printing it out to the pairingtable. Best regards Christian
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sat, 8 Sep 2007 14:59:00 +0200
To: Bugs in Games-Tournament-Swiss via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Oops, * On 2007-09-08 Christian Bartolomaeus (bartolin@gmx.de) wrote: Show quoted text
> [...] > I found a (really dirty) workaround for my problem.
just after sending my mail I saw that my workaround didn't work correctly (at least not in all test cases). The problem seems to be that the brackets are computed incorrectly. Within the pairingtable the results are correct but the brackets are not. Sorry for the noise. Christian
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sat, 8 Sep 2007 20:23:09 +0200
To: Bugs in Games-Tournament-Swiss via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, * On 2007-09-08 Christian Bartolomaeus (bartolin@gmx.de) wrote: Show quoted text
> [...]
> > [...] > > I found a (really dirty) workaround for my problem.
> > just after sending my mail I saw that my workaround didn't work > correctly (at least not in all test cases). The problem seems to be > that the brackets are computed incorrectly. Within the pairingtable > the results are correct but the brackets are not.
inserting the following code after line 87 (pairingtable) and line 90 (crosstable) seems to work better: $player->{score} += $score{$role}; for my $xxx (@{$tourney->entrants}) { if ($xxx->{id} eq $player->{id}) { $xxx->{score} = $player->{score}; } } Though it's definitely a dirty hack, still. Christian
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sun, 9 Sep 2007 08:17:24 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Wed, 05 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> ... "crosstable" and "pairingtable" don't > generate correct tables if ($round > 1).
If it is only given a pairing table for one particular round, 'crosstable' won't be able to find scores for individual rounds (and it needs to have them if it is to make a useful table, doesn't it?) I don't think anything can be done about that except tell the user they need to have the results for individual rounds and die. 'pairingtable' should be able to do the right thing, if it has both the pairing table and the results for the previous round. Show quoted text
> This corresponds to (or is caused by) missing values for "scores" in > yaml files (like player.yaml). A player.yaml file generated by version > 0.07 (pairingtable -> pairtable2yaml -> pair) reads
... Show quoted text
> scores: > 1: Draw
Show quoted text
> while the corresponding lines from a player.yaml file generated with > version 0.05 are:
Show quoted text
> scores: > 1: ~
Isn't it the other way round? The missing score is with version 0.07? Does this depend on whether you're using 'pair' or 'pairstately' to generate the YAML files? Show quoted text
> As a result, the method "score" from Contestant.pm seems to be unable > to compute the total scores after two or more rounds, and therefor the > crosstables and pairingtables aren't correct.
Perhaps it is a bug in the "score" code. I don't have a good grasp of the problem. Can you tell me what tournament, what round, and how you generated the files? Then I can try to run pairingtable and crosstable here. On Sat, 08 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> inserting the following code after line 87 (pairingtable) and line 90 > (crosstable) seems to work better:
Show quoted text
> $player->{score} += $score{$role}; > for my $xxx (@{$tourney->entrants}) { > if ($xxx->{id} eq $player->{id}) { > $xxx->{score} = $player->{score}; > } > }
Doesn't this replace the old score with the score in the latest individual round? It would be good to try and generate a YAML file of cumulative scores from the pairing table and the results for the round. I still prefer to regenerate scores from individual round results, but relying on a pairing table instead of individual results makes that difficult :-)
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sun, 9 Sep 2007 11:07:50 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-09-09 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...]
> > ... "crosstable" and "pairingtable" don't > > generate correct tables if ($round > 1).
> > If it is only given a pairing table for one particular round, > 'crosstable' won't be able to find scores for individual rounds > (and it needs to have them if it is to make a useful table, > doesn't it?) > > I don't think anything can be done about that except > tell the user they need to have the results for individual > rounds and die.
Yes, the results are in the scores/ directory. But somehow crosstable doesn't seem to use the results presented there, instead it takes the results from $tourney -- at least for its output. 64 $tourney = LoadFile "./$round/tourney.yaml"; [...] 124 my @rankedplayers = $tourney->rank(@$allRoundPlayers); [...] 134 for my $player ( @rankedplayers ) [...] 141 my @results = ($player->id, $player->name, $player->rating, $player->score) or die "$player->{id}'s results?"; [...] 145 $place, $player->id, $player->name, $player->rating, $player->score, @$results Show quoted text
> 'pairingtable' should be able to do the right thing, if it has > both the pairing table and the results for the previous round.
It seems to me, it's the same problem here: pairingtable takes the results from $tourney -- which doesn't have the correct entries. (tourney.yaml has the same problem as player.yaml -- see my old description below) Show quoted text
> > This corresponds to (or is caused by) missing values for "scores" in > > yaml files (like player.yaml). A player.yaml file generated by version > > 0.07 (pairingtable -> pairtable2yaml -> pair) reads
> > ...
> > scores: > > 1: Draw
>
> > while the corresponding lines from a player.yaml file generated with > > version 0.05 are:
>
> > scores: > > 1: ~
> > Isn't it the other way round? The missing score is with version > 0.07?
Oops, you're right. It's the other way around. Show quoted text
> Does this depend on whether you're using 'pair' or 'pairstately' > to generate the YAML files?
I use 'pair' to get that results. Somehow 'pairstately' fails to work: $> perl pairstately Use of uninitialized value in concatenation (.) or string at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117. PLAYER_1, 3 playing White got in round 1 at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117. Use of uninitialized value in pattern match (m//) at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 120. Use of uninitialized value in pattern match (m//) at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 120. Use of uninitialized value in pattern match (m//) at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 120. Use of uninitialized value in pattern match (m//) at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 120. Use of uninitialized value in concatenation (.) or string at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 127. Error: PLAYER_1 3's result in round 1 is ? at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 127. Show quoted text
> > As a result, the method "score" from Contestant.pm seems to be unable > > to compute the total scores after two or more rounds, and therefor the > > crosstables and pairingtables aren't correct.
> > Perhaps it is a bug in the "score" code. > > I don't have a good grasp of the problem. Can you tell me what > tournament, what round, and how you generated the files? Then I > can try to run pairingtable and crosstable here.
It's again a notional tournament with only for participants. The error occurs for round 3. I'll attach league.yaml, scores/1.yaml, scores/2.yaml and pairtable.yaml for round 2 and round 3. I generated the files automatically via my web frontend, but I'm pretty sure, that doesn't matter. 'pairtable.yaml' was created as described in README. You can see that pairtable.yaml.3 doesn't have the scores right (at the bottom). Show quoted text
> On Sat, 08 Sep 2007, Christian Bartolomaeus via RT wrote: >
> > inserting the following code after line 87 (pairingtable) and line 90 > > (crosstable) seems to work better:
>
> > $player->{score} += $score{$role}; > > for my $xxx (@{$tourney->entrants}) { > > if ($xxx->{id} eq $player->{id}) { > > $xxx->{score} = $player->{score}; > > } > > }
> > Doesn't this replace the old score with the score in the latest > individual round?
I think, it doesn't, since this is run within a for my $round ( @rounds ) {} construct. And the first line adds the score for the actual round to the old score -- so the scores are summed up while going through all rounds. Show quoted text
> It would be good to try and generate a YAML file of cumulative > scores from the pairing table and the results for the round. > > I still prefer to regenerate scores from individual round > results, but relying on a pairing table instead of individual > results makes that difficult :-)
May I ask what made you change the behaviour of 'pair' (to rely on pairing table instead of serialization files) in the first place? Best regards Christian

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

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

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

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

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

Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sun, 9 Sep 2007 11:11:21 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Sun, 09 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> .. crosstable doesn't seem to use the results presented there, > instead it takes the results from $tourney -- at least for its > output.
Show quoted text
> 64 $tourney = LoadFile "./$round/tourney.yaml";
LIne 76 loads the $round.yaml file, and line 86 gets the result for the player. After the collectCards method is called, the data is set up in $table by the $tourney object. Show quoted text
> 124 my @rankedplayers = $tourney->rank(@$allRoundPlayers); > [...] > 134 for my $player ( @rankedplayers ) > [...] > 141 my @results = ($player->id, $player->name, $player->rating, $player->score) or die "$player->{id}'s results?"; > [...] > 145 $place, $player->id, $player->name, $player->rating, $player->score, @$results
This code is about printing $table. Show quoted text
> > Does this depend on whether you're using 'pair' or 'pairstately' > > to generate the YAML files?
Show quoted text
> I use 'pair' to get that results. Somehow 'pairstately' fails to work:
Show quoted text
> $> perl pairstately > Use of uninitialized value in concatenation (.) or string at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117. > PLAYER_1, 3 playing White got in round 1 at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117.
It's failing to find the result for PLAYER_1 in scores/1.yaml. Strange that there should be a difference between the 2. Show quoted text
> It's again a notional tournament with only for participants. The error > occurs for round 3. I'll attach league.yaml, scores/1.yaml, > scores/2.yaml and pairtable.yaml for round 2 and round 3. I generated > the files automatically via my web frontend, but I'm pretty sure, that > doesn't matter. 'pairtable.yaml' was created as described in README.
Show quoted text
> You can see that pairtable.yaml.3 doesn't have the scores right (at > the bottom).
Strange that it works for me. First I ran 'pair' in 1/, then 'pairstately' in 2/ with your league.yaml and scores/1.yaml and scores/2.yaml. Then I ran crosstable and pairingtable in the top directory, and copied the output of pairingtable to pairtable.txt. Then I ran 'pairtable2yaml pairtable.txt' In pairtable.yaml at the bottom: score: 1: 1 2: 0.5 3: 0 4: 0.5 Show quoted text
> May I ask what made you change the behaviour of 'pair' (to rely on > pairing table instead of serialization files) in the first place?
The pairing table is lightweight. It has meaning to the users. With the score files, that need to be written anyway, it provides all the information that the serialization files provide.
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sun, 9 Sep 2007 15:00:25 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, * On 2007-09-09 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...]
> > .. crosstable doesn't seem to use the results presented there, > > instead it takes the results from $tourney -- at least for its > > output.
>
> > 64 $tourney = LoadFile "./$round/tourney.yaml";
> > LIne 76 loads the $round.yaml file, and line 86 gets the result > for the player.
sorry, I guess we spoke about different versions of crosstable. I was referring to your original script from v0.07. I guess you are referring to the version with my patch applied. In the following I will refer to the original version: Therefore, ... Show quoted text
> LIne 76 loads the $round.yaml file
this is line 68 in the original version, and Show quoted text
> and line 86 gets the result for the player.
this is line 78 in the original version. Right now, we have the results in $results->{ $player_name } But it's only the result of the actual round (since all this happens within a "for my $round ( @rounds ) {}"-construct (line 61). And somehow I think the values of $results->{ $player_name } aren't transfered to the $tourney object. Therefore I inserted the code $player->{score} += $score{$role}; for my $xxx (@{$tourney->entrants}) { if ($xxx->{id} eq $player->{id}) { $xxx->{score} = $player->{score}; } } to update the $tourney object Show quoted text
> After the collectCards method is called, the data is set up in > $table by the $tourney object.
I tried to insert test lines like for my $yyy ( @{$tourney->entrants} ) { if ($yyy->score) { print "$yyy->{name}: $yyy->{score}\n"; } } at different points at the code of crosstable. It never returned the total score for the players, only the score from round 1 (or nothing). What is your output when you insert the test lines in crosstable after line 120 and run the script at different times? * after pairing the first round and giving results in scores/1.yaml I get: ==== Round 1 Crosstable ------------------------------------------------------------------------- Rank No Name Rating Total 1 1 1 PLAYER_1 2200 1 3:W 2 2 PLAYER_2 2172 0.5 4:D 3 4 PLAYER_4 2060 0.5 2:D 4 3 PLAYER_3 2108 0 1:L ==== * after pairing the second round as well and giving results in scores/2.yaml I get: ==== PLAYER_1: 1 PLAYER_2: 0.5 PLAYER_4: 0.5 Round 2 Crosstable ------------------------------------------------------------------------- Rank No Name Rating Total 1 2 1 1 PLAYER_1 2200 1 3:W 2:D 2 2 PLAYER_2 2172 0.5 4:D 1:D 3 4 PLAYER_4 2060 0.5 2:D 3:D 4 3 PLAYER_3 2108 0 1:L 4:D ==== But that just seems wrong. The output should have been ==== PLAYER_1: 1.5 PLAYER_2: 1 PLAYER_3: 0.5 PLAYER_4: 1 Round 2 Crosstable ------------------------------------------------------------------------- Rank No Name Rating Total 1 2 1 1 PLAYER_1 2200 1.5 3:W 2:D 2 2 PLAYER_2 2172 1 4:D 1:D 3 4 PLAYER_4 2060 1 2:D 3:D 4 3 PLAYER_3 2108 0.5 1:L 4:D ==== ... as it is after my suggested change (adding the following lines after line 90): $player->{score} += $score{$role}; for my $xxx (@{$tourney->entrants}) { if ($xxx->{id} eq $player->{id}) { $xxx->{score} = $player->{score}; } } Show quoted text
> > 124 my @rankedplayers = $tourney->rank(@$allRoundPlayers); > > [...] > > 134 for my $player ( @rankedplayers ) > > [...] > > 141 my @results = ($player->id, $player->name, $player->rating, $player->score) or die "$player->{id}'s results?"; > > [...] > > 145 $place, $player->id, $player->name, $player->rating, $player->score, @$results
> > This code is about printing $table.
Yes, I just wanted to highlight, that the $tourney object somehow never was updated with the actual results. Show quoted text
> > > Does this depend on whether you're using 'pair' or 'pairstately' > > > to generate the YAML files?
>
> > I use 'pair' to get that results. Somehow 'pairstately' fails to work:
>
> > $> perl pairstately > > Use of uninitialized value in concatenation (.) or string at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117. > > PLAYER_1, 3 playing White got in round 1 at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117.
> > It's failing to find the result for PLAYER_1 in scores/1.yaml. > Strange that there should be a difference between the 2.
I didn't compare 'pair' and 'pairstately', but a simple diff gives a lot of differences. Didn't you modify 'pair' quite a lot to rely on pairing tables? Show quoted text
> > It's again a notional tournament with only for participants. The error > > occurs for round 3. I'll attach league.yaml, scores/1.yaml, > > scores/2.yaml and pairtable.yaml for round 2 and round 3. I generated > > the files automatically via my web frontend, but I'm pretty sure, that > > doesn't matter. 'pairtable.yaml' was created as described in README.
>
> > You can see that pairtable.yaml.3 doesn't have the scores right (at > > the bottom).
> > Strange that it works for me. First I ran 'pair' in 1/, then > 'pairstately' in 2/ with your league.yaml and scores/1.yaml and > scores/2.yaml. Then I ran crosstable and pairingtable in the top > directory, and copied the output of pairingtable to > pairtable.txt. Then I ran 'pairtable2yaml pairtable.txt'
Just to clarify: I did the following to get the results described above: 1. create league.yaml (in main directory ./) 2. run 'pair' (in directory ./1/) 3. create 1.yaml (in directory ./scores) 4. run 'crosstable (in directory ./) output: Round 1 Crosstable ----------------------------------------------------------------- Rank No Name Rating Total 1 1 1 PLAYER_1 2200 1 3:W 2 2 PLAYER_2 2172 0.5 4:D 3 4 PLAYER_4 2060 0.5 2:D 4 3 PLAYER_3 2108 0 1:L 5. run 'pairingtable (in directory ./) output: Round 2 Pairing Groups ----------------------------------------------------------------- Place No Opponents Roles Float Score 1 1 3 B 1 2-3 2 4 W 0.5 4 2 B 0.5 4 3 1 W 0 6. inserted the output from 5. to 'pairingtable.txt' (in directory ./) 7. run 'pairtable2yaml' (in directory ./) 8. create directory ./2 and copy 'pairtable.yaml' to that directory 9. run 'pair' (in directory ./2) 10. create 2.yaml (in directory ./scores) 11. run 'crosstable (in directory ./) output: Round 1 Crosstable ----------------------------------------------------------------- Rank No Name Rating Total 1 2 1 1 PLAYER_1 2200 1 3:W 2:D 2 2 PLAYER_2 2172 0.5 4:D 1:D 3 4 PLAYER_4 2060 0.5 2:D 3:D 4 3 PLAYER_3 2108 0 1:L 4:D which is wrong, since the total scores are the ones from round 1. 12. run 'pairingtable (in directory ./) output: Round 3 Pairing Groups ------------------------------------------------------------------------- Place No Opponents Roles Float Score 1 1 3,2 BB D 1 2-3 2 4,1 WW U 0.5 4 2,3 BB D 0.5 4 3 1,4 WW U 0 which is wrong again. Show quoted text
> In pairtable.yaml at the bottom: > > score: > 1: 1 > 2: 0.5 > 3: 0 > 4: 0.5
But after two rounds the output should have been: score: 1: 1.5 2: 1 3: 0.5 4: 1 Or am I totally of the track? Best regards Christian
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sun, 9 Sep 2007 15:26:36 +0000
To: bug-Games-Tournament-Swiss [...] rt.cpan.org
From: Greg Matheson <drbean [...] freeshell.org>
On Sun, 09 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> sorry, I guess we spoke about different versions of crosstable. I was > referring to your original script from v0.07. I guess you are > referring to the version with my patch applied.
I had a different version of pairstately. The version in 0.07 is broken. Line 116 in pairstately: my $result = $results->{$n}->{ $player->name }; should be my $result = $results->{ $player->name }; Show quoted text
> $player->{score} += $score{$role}; > for my $xxx (@{$tourney->entrants}) { > if ($xxx->{id} eq $player->{id}) { > $xxx->{score} = $player->{score}; > } > }
I think only the first line of that is necessary. Strange that that should work if $result is undefined. Show quoted text
> I tried to insert test lines like
Show quoted text
> for my $yyy ( @{$tourney->entrants} ) { > if ($yyy->score) { print "$yyy->{name}: $yyy->{score}\n"; } > }
Show quoted text
> at different points at the code of crosstable. It never returned the > total score for the players, only the score from round 1 (or nothing).
It was never finding the scores in 1.yaml. Show quoted text
> Round 2 Crosstable > ------------------------------------------------------------------------- > Rank No Name Rating Total 1 2 > 1 1 PLAYER_1 2200 1.5 3:W 2:D > 2 2 PLAYER_2 2172 1 4:D 1:D > 3 4 PLAYER_4 2060 1 2:D 3:D > 4 3 PLAYER_3 2108 0.5 1:L 4:D > ====
Show quoted text
> ... as it is after my suggested change (adding the following lines > after line 90):
Show quoted text
> $player->{score} += $score{$role}; > for my $xxx (@{$tourney->entrants}) { > if ($xxx->{id} eq $player->{id}) { > $xxx->{score} = $player->{score}; > } > }
I can't see how that would work. Show quoted text
> > > > Does this depend on whether you're using 'pair' or 'pairstately' > > > > to generate the YAML files?
Show quoted text
> > > I use 'pair' to get that results. Somehow 'pairstately' fails to work:
'pair' doesn't read any data from scores/$round.yaml files. It just depends on the pairing table. I don't think you can use pair the same way as pairstately unless you hack it in some way like you did. I would prefer to keep the score files out of pair at the moment. Show quoted text
> > > $> perl pairstately > > > Use of uninitialized value in concatenation (.) or string at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117. > > > PLAYER_1, 3 playing White got in round 1 at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117.
I think if you make the change above to pairstately, it should work as before.
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sun, 9 Sep 2007 19:53:29 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-09-09 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...] > I had a different version of pairstately. The version in 0.07 is > broken. Line 116 in pairstately: > > my $result = $results->{$n}->{ $player->name }; > > should be > > my $result = $results->{ $player->name };
I will have a look at pairstately later. Thanks for the information. Show quoted text
> > $player->{score} += $score{$role}; > > for my $xxx (@{$tourney->entrants}) { > > if ($xxx->{id} eq $player->{id}) { > > $xxx->{score} = $player->{score}; > > } > > }
> > I think only the first line of that is necessary.
Hmm. If I delete the other lines it doesn't work correctly. The total score printed out doesn't fit with the sum of the scores from the single rounds. Output for round 1: Round 1 Crosstable ------------------------------------------------------------------------- Rank No Name Rating Total 1 1 1 PLAYER_1 2200 1 3:W 2 2 PLAYER_2 2172 0.5 4:D 3 4 PLAYER_4 2060 0.5 2:D 4 3 PLAYER_3 2108 0 1:L Output for round 2: Round 2 Crosstable ------------------------------------------------------------------------- Rank No Name Rating Total 1 2 1 1 PLAYER_1 2200 1 3:W 2:D 2 2 PLAYER_1 2172 0.5 4:D 1:D 3 4 PLAYER_1 2060 0.5 2:D 3:D 4 3 PLAYER_1 2108 0 1:L 4:D Show quoted text
> Strange that that should work if $result is undefined.
I don't understand. Why should $result be undefined? We are talking about 'crosstable' here, aren't we? Show quoted text
> > I tried to insert test lines like
>
> > for my $yyy ( @{$tourney->entrants} ) { > > if ($yyy->score) { print "$yyy->{name}: $yyy->{score}\n"; } > > }
>
> > at different points at the code of crosstable. It never returned the > > total score for the players, only the score from round 1 (or nothing).
> > It was never finding the scores in 1.yaml.
Sorry, maybe I didn't wrote what wanted to express. I referred to the output of 'crosstable'. I just inserted the above lines to the code of crosstable so that the name and the score of players are printed to the standard output. There was nothing written to a file. Show quoted text
> > Round 2 Crosstable > > ------------------------------------------------------------------------- > > Rank No Name Rating Total 1 2 > > 1 1 PLAYER_1 2200 1.5 3:W 2:D > > 2 2 PLAYER_2 2172 1 4:D 1:D > > 3 4 PLAYER_4 2060 1 2:D 3:D > > 4 3 PLAYER_3 2108 0.5 1:L 4:D > > ====
>
> > ... as it is after my suggested change (adding the following lines > > after line 90):
>
> > $player->{score} += $score{$role}; > > for my $xxx (@{$tourney->entrants}) { > > if ($xxx->{id} eq $player->{id}) { > > $xxx->{score} = $player->{score}; > > } > > }
> > I can't see how that would work.
Well, for some reason it does work for me. You say, crosstable works for you, following the steps from my last post? Then I have to search for a problem with my scripts and files. Show quoted text
> > > > > Does this depend on whether you're using 'pair' or 'pairstately' > > > > > to generate the YAML files?
>
> > > > I use 'pair' to get that results. Somehow 'pairstately' fails to work:
> > 'pair' doesn't read any data from scores/$round.yaml files. It just > depends on the pairing table. > > I don't think you can use pair the same way as pairstately unless > you hack it in some way like you did. I would prefer to keep the > score files out of pair at the moment.
Well, but 'pair' writes all those files (like tourney.yaml) on which 'crosstable' and 'pairingtable' depend. And I have the impression that 'pair' doesn't write those files correctly -- at least crosstable isn't able to compute the total scores correctly. Actually, I didn't hack 'pair' at all. I just hacked 'crosstable' and 'pairingtable' ;-) Show quoted text
> > > > $> perl pairstately > > > > Use of uninitialized value in concatenation (.) or string at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117. > > > > PLAYER_1, 3 playing White got in round 1 at /opt/perl_modules/Games-Tournament-Swiss-0.07/script_files/pairstately line 117.
> > I think if you make the change above to pairstately, it should > work as before.
Okay, I will try this. I'm sorry for the confusion I caused with my bug report. Maybe I didn't express my problem properly. Thanks Christian
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Sun, 9 Sep 2007 20:17:00 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-09-09 Christian Bartolomaeus (bartolin@gmx.de) wrote: Show quoted text
> [...]
> > I had a different version of pairstately. The version in 0.07 is > > broken. Line 116 in pairstately: > > > > my $result = $results->{$n}->{ $player->name }; > > > > should be > > > > my $result = $results->{ $player->name };
> > I will have a look at pairstately later. Thanks for the information.
I can confirm that everything works fine with the fixed 'pairstately'. So my problem obviously was: Pairstately failed to work without the fix. Therefore I used pair. Somehow the YAML files in the $round/ subdirectory generated by pair aren't suited for providing 'crosstable' and 'pairingtable' the correct informations about the total scores. [I think it's all about the lines like scores: 1: Win 2: Draw in the YAML files generated by 'pairstately'. As I noted in my original post, the entries generated by 'pair' looked like scores: 1: ~ 2: ~ But there was an additional line in the files generated by 'pair': score: 1.5 This line obviously contained the total score for a player, but 'crosstable' and 'pairingtable' weren't able to use that value.] In the end, I hacked 'crosstable' and 'pairingtable' to cope with the output of 'pair'. Instead I should have tried to fix 'pairstately', because 'crosstable' and 'pairingtable' don't have problems with the YAML files generated by 'pairstately'. So if you think, the syntax of the YAML files generated by 'pair' is fine, this bug could be closed. Thanks Christian
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Mon, 17 Sep 2007 21:32:34 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, I just wanted to point to those failed tests at http://cpantesters.perl.org/show/Games-Tournament-Swiss.html#Games-Tournament-Swiss-0.08 If one takes a closer look at the 4th test for version 0.08 there [1], the output from 'make test' contains warnings like Variable "$scores" will not stay shared at lib/Games/Tournament.pm line 362. Maybe that's related to the problem I reported. Best regards. Christian [1] http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg637308.html
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Tue, 18 Sep 2007 08:30:19 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Mon, 17 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> Variable "$scores" will not stay shared at lib/Games/Tournament.pm > line 362.
I wondered about that message, which I don't see. Do you see it when you run tests? Show quoted text
> Maybe that's related to the problem I reported.
The problem code has been in there since version 0.03, so it's probably not related, but I took it out anyway.
Subject: Re: [rt.cpan.org #29184] scores aren't recorded properly
Date: Tue, 18 Sep 2007 11:42:11 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-09-18 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...]
> > Variable "$scores" will not stay shared at lib/Games/Tournament.pm > > line 362.
> > I wondered about that message, which I don't see. Do you see > it when you run tests?
No, I don't. Maybe that's related to the perl version? I use 5.8.8 and the failed tests giving message seem to use 5.9.5. [Though I didn't check for all tests.] Maybe the tests of 5.9.5 are more sophisticated and therefore detect a problem which the tests of 5.8.5 don't find? On the other hand I know next to nothing about making tests with perl. The only warning messages I get are: Show quoted text
> t/cc6619....[...] > No result in round 1 for player 2, Two as Black at t/cc6619.t line 173 > No result in round 1 for player 3, Three as White at t/cc6619.t line 173 > No result in round 1 for player 4, Four as Black at t/cc6619.t line 173
... and so on. But I guess, you get those messages also. Best regards Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

pair seems to work in more recent versions. I am closing this report. Creating a pairing table still relies on YAML serialization files, which is something I would like to get rid of.