This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Re: Two more AI bugs
>> The culprit was the static array apnbt_types that was introduced 18
>> months ago when Stan removed the MAXUTYPES restrictions in xconq. This
>> array was not zeroed
>
>Nice catch. I've been seeing some strange building behavior in the
>standard game, but it's hard to say whether this might be it.
This bug only hit acp-independent units, so it would not affect the
standard game. But we should check that all the other static arrays that
were introduced at the same time are zeroed. I already checked the
acp-dependent build code in ai.c (preferred_build_type) and it seems to be
OK.
>I've been thinking of writing some automated unit tests for xconq
>(sample for this bug: take a known map and set of units, then call
>auto_pick_new_build_task which is somehow rigged up to return back to
>the test code around the select_by_weight call (which then checks the
>weights against a known answer). But I haven't had much time, and as
>can be seen by this example, it can be hard to know what level to hook
>the test code in at. But it would prevent this kind of regression,
>which can be kind of hard to spot by just noticing that the AI seems
>stupider.
Perhaps one of the existing test games could be adapted for this?
Hans
Hans Ronne
hronne@pp.sbbs.se