Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2002:
[freeciv-ai] Re: ai bodyguard code cleanup part#1

[freeciv-ai] Re: ai bodyguard code cleanup part#1

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: ai bodyguard code cleanup part#1
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 10 Aug 2002 19:05:54 +0000 (GMT)

On Sat, 10 Aug 2002, Gregory Berkolaiko wrote:
> I can't say I love your style.Also I cannot say that you changed all var
> names that are crying to be changed (like i in ai_military_bodyguard).
> I also suppose you could write more comments.

Well, I wanted to make a small patch, so I didn't fix all style issues or
all variables and I didn't take time to write long comments either (in
particular since I will change them quite a bit anyway).

> First of all, I would write it as:
> unit_list_iterate(pplayer->units, body) {
> if (body->ai.charge == buddy->id) {
>   /* it appears buddy already has a bodyguard,
>    * so it's not a good charge */
>   def = 0;
> }
> } unit_list_iterate_end;


> More importantly, there is a check before that,
> if (buddy->ai.bodyguard == 0) continue;
> which means that if we got to "def = 0;", buddy has a bodyguard but is not
> aware of it.This is bad: we have a doubly linked pair and one of the
> links is broken.If you are seriously working on the bodyguards, you have
> to catch all such occurences and fix them or explain them.

There are many issues like this. Fixing it would give autogame difference,
so I left it for next wave.

> Ha, now I see why your diplomats were not getting the bodyguards: they are
> too fast!!

That is one problem. Before mech inf, maybe making smart use of our fast
movement (not stopping next to city) is better than bodyguard. But when we
get mech inf, we definitely want bodies. Especially now that the AI will
make aggressive use of incitement. Anyway, the current code should
recognize this already.


[Prev in Thread] Current Thread [Next in Thread]