[Freeciv-Dev] Re: [PATCH] [1.1] move some common AI equations to kill_de
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, Feb 24, 2002 at 01:41:43PM -0800, Petr Baudis wrote:
> Hello,
>
> attached patch introduces kill_desire() function, where it moves another
> common equation used in AI military functions. Behaviour is not changed
> (autogames are same). Oh, yes, and it seems to me that it compiles.
>
> I think it's ready to actually go in, altough I'm open to objections and
> ideas how to extend/correct it even more. The patch is pretty obvious and tiny
> and I want to keep it so - no more cleanups in this round. It unfortunately
> removes much less common code than I expected first, but anyway, it won't
> hurt,
> and I may move more redundant code to common functions in the future. I
> however
> hope that it'll get commited fast :).
>
> Ah, note that this patch is obviously only fifh in very long line. And as
> I'm
> modifying more files at once now, I'm counting revisions of the patch from
> 1.1.
>
> Happy reviewing ;),
> Index: advdomestic.c
> ===================================================================
> RCS file: /home/cvs/aiciv/freeciv-a2/ai/advdomestic.c,v
> retrieving revision 1.1.1.5
> retrieving revision 1.20
> diff -u -r1.1.1.5 -r1.20
It looks like you still have a broken cvs/diff.
> /**************************************************************************
> +Compute how much we want to kill certain victim we've chosen.
> +
> +Benefit is something like 'attractiveness' of the victim, how nice it would
> be
> +to destroy it. Larger value, worse loss for enemy.
> +
> +Attack is the total possible attack power we can throw on the victim. Note
> that
> +we will even square this.
> +
> +Loss is the possible loss when we would lose the unit we want to attack.
> +
> +Vuln is vulnerability of our unit when attacking the enemy.
> +**************************************************************************/
> +int kill_desire(int benefit, int attack, int loss, int vuln, int
> victim_count)
> +{
> + int desire;
> +
> + /* attractiveness danger */
> + desire = ((benefit * attack - loss * vuln) * victim_count *
> SHIELD_WEIGHTING
> + / (attack + vuln * victim_count));
> +
> + return desire;
> +}
Can it be that benefit is only the benefit of the first/best enemy
unit? Simply multiplying this with victim_count seems wrong.
> - /* We're only dealing with adjacent victims here. */
> - int move_cost = 0;
You said that you need move_cost for the cleanup and that it is part
of the general formula. AFAI see this isn't the case.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"From what I am reading Win98 and NT5.0 will be getting rid of all that
crap anyway. Seems that Microsoft has invented something called TCP/IP and
another really revolutionary concept called DNS that eliminates the
netbios crap too. All that arping from browsers is going to go away.
I also hear rumors that they are on the verge of breakthrough discoveries
called NFS, and LPD too. Given enough time and money, they might
eventually invent Unix."
-- George Bonser in linux-kernel
- [Freeciv-Dev] [PATCH] [1.1] move some common AI equations to kill_desire() (PR#1279), Petr Baudis, 2002/02/24
- [Freeciv-Dev] Re: [PATCH] [1.1] move some common AI equations to kill_desire() (PR#1279),
Raimar Falke <=
- [Freeciv-Dev] Re: [PATCH] [1.1] move some common AI equations to kill_desire() (PR#1279), Raahul Kumar, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Petr Baudis, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Raahul Kumar, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Petr Baudis, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Raahul Kumar, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Petr Baudis, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Raahul Kumar, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Petr Baudis, 2002/02/25
- [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279), Raimar Falke, 2002/02/25
|
|