Complete.Org: Mailing Lists: Archives: freeciv-ai: January 2003:
[freeciv-ai] Re: kill_something_with() stupidities
Home

[freeciv-ai] Re: kill_something_with() stupidities

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: Freeciv AI development <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] Re: kill_something_with() stupidities
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Wed, 29 Jan 2003 11:04:46 +0000 (GMT)

On Tue, 28 Jan 2003, Per I. Mathisen wrote:

> ai/advmilitary.c:
> 
>   /* Consider a land attacker */
>   unit_type = ai_choose_attacker(pcity, LAND_MOVING);
>   if (unit_type >= 0) {
>     assert(can_build_unit(pcity, unit_type));
>     virtualunit = create_unit_virtual(pplayer, pcity, unit_type, TRUE);
>     kill_something_with(pplayer, pcity, virtualunit, choice);
>     destroy_unit_virtual(virtualunit);
>   }
> 
> It looks like the unit we're giving to ksw is the unit we're considering
> building. But that is deceptive! ksw does its very own evaluation of which
> unit it wants to build, essentially throwing away the result from
> ai_choose_attacker(), making the latter essentially redundant. The

Yes and no.  Although algorithm could be much clearer, it is quite clever:
1. ai_choose_attacker gives the first crude approximation at what can 
be built.
2. kill_something_with calls f_s_t_k to find a victim for this unit.
3. then k_s_w looks for the best unit to kill this particular victim 
(maybe we can do it better with a cheaper unit, say).

This is explained in the comment to ksw, I believe.

> evaluation done in ksw is also buggy, allowing forbidden units to be built
> by AI, which I discovered after several hours of debugging a non-AI patch.

I am not sure what you call a forbidden unit.  Those that we cannot build 
yet?  It sure evaluates those, and if it finds them useful, it bumps up 
the tech want.  But I don't think it actually builds them :(

By the way, how about committing my patch of 2nd January (I haven't 
committed it yet, have I), while you are looking at ksw?  It might 
simplify your task.

G.





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