Skip Menu |

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

Report information
The Basics
Id: 29674
Status: open
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: method 'updateScores' in Tournament.pm
Date: Sun, 30 Sep 2007 00:22:34 +0200
To: bug-Games-Tournament-Swiss [...] rt.cpan.org
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, trying to use the Games::Tournament::Swiss modules, I discovered a problem with method 'updateScores' from Tournament.pm. It seems to me, that line 282 of Tournament.pm my $roles = $self->roles; causes problems, because there is no method 'roles' defined. After changing that line to my $roles = [qw/Black White/]; it worked for me. Apart from this, I didn't fully understand how to use method 'score' from Games::Tournament::Contestant correctly. If I try to call this method via $player->score it seems to me, that %converter isn't initialized (via use constant). There must be a simple solution to this problem, because it works fine with your scripts (for instance with 'crosstable'). I had to define %converter manually via %converter = ('win','1','loss','0','draw','0.5','absent','0','bye','1'); Do you have a tip for me here? Thanks Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

On Sat Sep 29 18:24:02 2007, bartolin@gmx.de wrote: Show quoted text
> It seems to me, that line 282 of Tournament.pm
Show quoted text
> my $roles = $self->roles;
Show quoted text
> causes problems, because there is no method 'roles' > defined. After changing that line to
Show quoted text
> my $roles = [qw/Black White/];
Show quoted text
> it worked for me.
In my scripts, I think I have stopped using updateScores. I generate Games::Tournament::Card objects, and then use the collectCards method, so the Games::Tournament::Swiss object has access to those objects. I don't know whether to just remove the updateScores method, or to get it working again. What are the advantages of using that method, over collectCards? I don't have a good idea of the work process of the arbiter. If the (names of the) methods corresponded to the sequence of tasks that the arbiter carried out, it would be obvious to the script writer which methods to choose and how to write the script. The methods are very fragile, so if you try to develop your own sequence it is difficult to get the script to work. I had more trouble writing the scripts than the modules. As for roles, I'm now using a Games::Tournament::Swiss::Config class to allow the programmer to set their own values for ROLES, SCORES, FIRSTROUND, etc. This makes it more difficult for you. You have to set these in a BEGIN block in your script. But it allows me to use roles other than Black and White and different scores, etc in a non-standard match situation. I think if you take out the call to the roles method, and substitute (ROLES)[0] and (ROLES)[1] for $roles->[0], etc, in updateScores, it should work, as long as you have the BEGIN block in your script, like in my scripts. WAIT. I don't have a BEGIN block in my scripts! I guess you don't need your own BEGIN block. You set the values like, my $scores = $league->{scores} || { win => 1, loss => 0, draw => 0.5, absent => 0, bye => 1 }; %Games::Tournament::Swiss::Config::scores = %$scores; It must be due to not having 'use Games::Tournament::Swiss::Config' at the start, which sets the defaults. Show quoted text
> Apart from this, I didn't fully understand how to use > method 'score' from Games::Tournament::Contestant > correctly. If I try to call this method via
Show quoted text
> $player->score
Show quoted text
> it seems to me, that %converter isn't initialized (via use > constant). There must be a simple solution to this > problem, because it works fine with your scripts (for > instance with 'crosstable'). I had to define %converter > manually via %converter = > ('win','1','loss','0','draw','0.5','absent','0','bye','1');
That sounds like it might also be solved by using Games::Tournament::Swiss::Config. Does the above change to roles in Games::Tournament work?
Subject: Re: [rt.cpan.org #29674] method 'updateScores' in Tournament.pm
Date: Sun, 30 Sep 2007 14:01:33 +0200
To: Dr Bean via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-09-30 Dr Bean via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...]
> > It seems to me, that line 282 of Tournament.pm
>
> > my $roles = $self->roles;
>
> > causes problems, because there is no method 'roles' > > defined. After changing that line to
>
> > my $roles = [qw/Black White/];
>
> > it worked for me.
> > In my scripts, I think I have stopped using updateScores. I > generate Games::Tournament::Card objects, and then use the > collectCards method, so the Games::Tournament::Swiss object > has access to those objects.
ahh, well. I tried that and it worked. Using the collectCards method is fine for me. Show quoted text
> I don't know whether to just remove the updateScores method, > or to get it working again. > > What are the advantages of using that method, over > collectCards? > > I don't have a good idea of the work process of the arbiter. > If the (names of the) methods corresponded to the sequence > of tasks that the arbiter carried out, it would be obvious > to the script writer which methods to choose and how to > write the script.
Unfortunately I can't help here, because I'm not familiar with the tasks of arbiters, neither. To take a list of games and to update the Games::Tournament::Card objects accordingly seems quite straightforward for me. Show quoted text
> As for roles, I'm now using a > Games::Tournament::Swiss::Config class to allow the > programmer to set their own values for ROLES, SCORES, > FIRSTROUND, etc. > > This makes it more difficult for you. You have to set these > in a BEGIN block in your script. > > But it allows me to use roles other than Black and White and > different scores, etc in a non-standard match situation. > > I think if you take out the call to the roles method, and > substitute (ROLES)[0] and (ROLES)[1] for $roles->[0], etc, > in updateScores, it should work, as long as you have the > BEGIN block in your script, like in my scripts. > > WAIT. I don't have a BEGIN block in my scripts! I guess you > don't need your own BEGIN block. You set the values like, > > my $scores = $league->{scores} || > { win => 1, loss => 0, draw => 0.5, absent => 0, bye => 1 }; > %Games::Tournament::Swiss::Config::scores = %$scores;
I got it to work. The trick was, that I had to define those values before the line require Games::Tournament::Swiss; Now it works fine. Show quoted text
> It must be due to not having > 'use Games::Tournament::Swiss::Config' at the start, which > sets the defaults. >
> > Apart from this, I didn't fully understand how to use > > method 'score' from Games::Tournament::Contestant > > correctly. If I try to call this method via
>
> > $player->score
>
> > it seems to me, that %converter isn't initialized (via use > > constant). There must be a simple solution to this > > problem, because it works fine with your scripts (for > > instance with 'crosstable'). I had to define %converter > > manually via %converter = > > ('win','1','loss','0','draw','0.5','absent','0','bye','1');
> > That sounds like it might also be solved by using > Games::Tournament::Swiss::Config. > > Does the above change to roles in Games::Tournament work?
I'm afraid, I'm not absolutely sure what change did the trick. But I think, it was the definition of $scores at the start of my script: my $scores = { win => 1, loss => 0, draw => 0.5, absent => 0, bye => 1 }; %Games::Tournament::Swiss::Config::scores = %$scores; With that lines, everything works fine. Thanks, Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.