Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [PATCH] [1.1] move some common AI equations to kill_de
Home

[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]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] [1.1] move some common AI equations to kill_desire() (PR#1279)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Mon, 25 Feb 2002 14:41:03 +0100

Dear diary, on Sun, Feb 24, 2002 at 11:37:33PM CET, I got a letter,
where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> > 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.

Yup. I've no idea how to fix it.

> >  /**************************************************************************
> > +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.

The best defender. The simple multiplying may be slightly inaccurate but I
think it's accurate enough - otherwise our life would be a lot worse and the
code would slow down significantly as well, I believe.

This was anyway probably just some additional hack:

/* AI was not sending enough reinforcements to totally wipe out a city
and conquer it in one turn.  This variable enables total carnage. -- Syela */

> > -        /* 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.

After all it isn't - I was wrong and I imagined it simpler than it was :(. I
fix my mistake in this patch.

-- 

                                Petr "Pasky" Baudis

* elinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
No one can feel as helpless as the owner of a sick goldfish.
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/


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