[Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Dear diary, on Wed, Feb 20, 2002 at 03:51:47PM CET, I got a letter, where
Raahul Kumar <raahul_da_man@xxxxxxxxx> told me, that...
> > /me looks around in his mailbox.. /me sees nothing :(
> >
>
> Great explanation of the attack/defending formulas. You've really done some
> work on this.
I just stared at the code.. (Greg: and thought about it ;)
> > + /* The possible loss when we would loose this unit. */
> > + /* TODO: Possibly remove this when moving the desire equiation to
> > + * separate function? */
>
> Equation instead of equiation.
Thanks.
> > + if (map_get_city(x1, y1)) {
> > + benefit = (benefit + 40) * punit->hp / unit_type(punit)->hp;
> > }
> > - }
> > - } else { /* no pdef */
> > - pcity = map_get_city(x1, y1);
> > - if (pcity && is_ground_unit(punit) &&
> > - map_get_terrain(punit->x, punit->y) != T_OCEAN) {
> > - if (pcity->owner != pplayer->player_no) { /* free goodies */
> > - best = 99999; *dest_y = y1; *dest_x = x1;
> > +
> > + /* If we have non-zero belligerence... */
> > + if (attack > 0 && is_my_turn(punit, pdef)) {
> > + int desire;
> > +
> > + /* TODO: This equation is simplified version of much worse ones
> > in
> > + * that long fat routines, but it's still a common pattern, so we
> > + * will can this equation to one separate readable function. */
> > +
> > + /* attractiveness danger */
> > + desire = ((benefit * attack - loss * vuln) * SHIELD_WEIGHTING
> > + / (attack + vuln) - move_cost * SHIELD_WEIGHTING);
> > +
>
> The usage of move_cost. I do not see how the penalty for attacking with less
> than one movepoint left is represented in this formula.
There's really no usage of move_cost here. As few lines above mentioned,
move_cost is always zero here because we're always dealing only with adjectent
victims here (so we also have at least one movepoint left as well).
Typo fixed in attached 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/
findvictim-cleanup.patch
Description: Text document
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), (continued)
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Gregory Berkolaiko, 2002/02/16
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Petr Baudis, 2002/02/16
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Gregory Berkolaiko, 2002/02/17
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Petr Baudis, 2002/02/17
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Gregory Berkolaiko, 2002/02/17
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Petr Baudis, 2002/02/17
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Gregory Berkolaiko, 2002/02/18
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Raimar Falke, 2002/02/18
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Petr Baudis, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Raahul Kumar, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264),
Petr Baudis <=
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Raimar Falke, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Petr Baudis, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Raimar Falke, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Mike Kaufman, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Raimar Falke, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Gregory Berkolaiko, 2002/02/21
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Petr Baudis, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Raimar Falke, 2002/02/20
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Gregory Berkolaiko, 2002/02/21
- [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264), Petr Baudis, 2002/02/21
|
|