* 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