[en] Bug Reports
13.08.06 - 15:51
Please report all minor and major bugs or annoyances here. An error message and/or description is usually helpful. ;o)
11.12.09 - 10:06
We're currently getting this error right after init:
'Not a CODE reference at /home/cosair/lib/Cosair/AI/Bot/ line 547. '

The line is:
foreach my $nme ($self->control->active_nme_nations) {

The sub it belongs to is being called by init_turn.
To confirm it's not our code I restored an older, working version and it's still happening.
11.12.09 - 10:21
Please don't mind that I take over your bot and change the online version in such a case.
11.12.09 - 10:38
Maybe this is helpful:
Before the error above occured, it showed a different one, but only once.
It was something like Cosair::AI:Bot::undefined::control is not a method.
11.12.09 - 10:38
Ok, I got the same error.

Changing to:

my @nme_nations = $self->control->active_nme_nations;
foreach my $nme (@nme_nations)

helped, but reloading the server makes your original code work as well. This could be related to previous errors, which choked the Apache.

11.12.09 - 10:43
Ok, please proceed as normal, I hope this won't happen too often.
The only constellation I can think of spontaneously, is that things break apart if you upload your code while it is executing.
11.12.09 - 15:58
We get a strange error message:

"84 'Fatal warning: Use of uninitialized value $element in string eq at /home/cosair/lib/Cosair/ line 17. '

We do not really know why this happens. We found an old posting of "Chrisch", he had the same problem (at this time it was line 19) but you said you fixed it. If we get the same error, other line, perhaps you can figure out what might be the problem.

This error occurs after sending out our colonyship and switching to the state BUILD. And this happens every turn, so SNFAU ;)

Oh, and btw. In Cosair::Util might be an error in line 15; there you wrote "sub asser($$);" but in line 25 it is assert. Perhaps this is an old file?

11.12.09 - 16:26
And I am quite sorry about this, I tried something on my computer. So I changed the @ISA line to something else and did not recognize it when i uploaded it the last time (actually now it was not the last time, but at this time it was). I tried to start a game but it failed. I came to the start page with a trick (typed in the correct adress) and somehow it seemed like changing the @ISA-line crashed the server.
Sorry for this, next time I will read my code more carefully
11.12.09 - 17:30
Not really. Looks like you confuse Cosair::AI::Util with Cosair::Util.

In Cosair::Util, which you cannot see of course, this is thrown by the contained method, wich is called with an undef element. I added a warning with caller there, and the problem comes from AI/ line 473, which means you call the "can_build" method with an undef building.

Botton line, I should probably add the full call stack for warnings and errors.
12.12.09 - 12:35
btw, that call was at line 320 in your code.
13.12.09 - 12:18
Thanks a lot, we've been able to fix these and some more and the latest version has so far been error-free. Here's hoping it actually is ;)

Something we noticed though:
The bot will sometimes research a tech that has already been reasearched again.
In our case it was when we first researched autofabrication, then changed the techlist to one where autofabrication is in second place before it was done researching.
13.12.09 - 13:29
That can only be an error in my code, yes.

The stack trace is not that easy, sorry, because it becomes very very long including lots of Apache internals. I will have to extract the stack down to the bot and cut the rest. Don't know if I will get this done for this year.

I have already changed more than I intended to. ;-)

In general, it might be a good idea to include a "use warnings;" below the "use strict;" in your code. That's a safe change and might catch problems before they occur in lower layers. I already added it to the default code template.

Just in case, you can also add a "no warnings 'redefine';" which can help you in case an Apache thread gets something wrong at reloading bot code.
17.12.09 - 10:31
Hi. It's us - again ;)
What Wolfgang forgot to ask about:
For some time now we've been doing some fancy things with taxrates. To do that we first build a convenient data structure, like so:
my @taxrates = (20,30,40,50,60,70,80);
my @taxdata = ();
foreach my $taxrate (@taxrates) {
my %tax = ();
$tax{taxrate} = $taxrate;
$tax{research} = $self->nation->research;
$tax{income} = $self->nation->net_income;

What we've noticed is that while net_income is consistent with the values presented in a testgame, research is not. It's exactly the opposite, e.g. when starting a game, research is 4 at 80% tax and 1 at 20%.
For now we've been working around this by setting tax to 100-$taxrate, getting research and then setting it to $taxrate, which gives values exactly as in the testgame.
17.12.09 - 11:25
Indeed there is a serious bug in the API here, thanks a lot for spotting it. I corrected it.
17.12.09 - 11:32
good news, your bot is the only one using this method, so where was nothing broken up to now.
17.12.09 - 11:37
btw, you can shorten this type of data structure creation like this:

my %tax = (
taxrate => $taxrate,
research => $self->nation->research,
income => $self->nation->net_income,
17.12.09 - 11:38
or simply:

push @taxdata, {
taxrate => $taxrate,
research => $self->nation->research,
income => $self->nation->net_income,
Back to Topic Overview

Back to Main Page