Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: [PATCH] aiunit.c ai_manage_explorer cleanup (PR#1210)
Home

[Freeciv-Dev] Re: [PATCH] aiunit.c ai_manage_explorer cleanup (PR#1210)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: rf13@xxxxxxxxxxxxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] aiunit.c ai_manage_explorer cleanup (PR#1210)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Sun, 13 Jan 2002 22:13:00 +0100

Dear diary, on Tue, Jan 08, 2002 at 01:24:57PM CET, I got a letter, where
Raahul Kumar <raahul_da_man@xxxxxxxxx> told me, that...
> --- Petr Baudis <pasky@xxxxxxxxxxx> wrote: >
> <snip> 
> > Updated patch attached. Compiles ;-).
> > 
> > I'm now not sure if ai_manage_explore() wouldn't be even more appropriate.
> > What you guys think?
> >
> 
> I think I liked GB's warmap patch better. But it looks like that will never
> see the light of day. Your patch is certainly am improvement on the existing
> state of the AI.
It's cleaning up this function as well? If it does, and it's available
somewhere, I would like to see it as an inspiration.

> > +  /* Get the range */
> > +
> >    if (unit_profits_of_watchtower(punit)
> >        && map_get_tile(punit->x, punit->y)->special & S_FORTRESS)
> > -    range =get_watchtower_vision(punit);
> > +    range = get_watchtower_vision(punit);
> >    else
> >      range = unit_type(punit)->vision_range;
> >
> 
> GB got rid of the units profitting from the wachtower vision. He said that
> apparently it made no difference, since this was the starting destination,
> and our end point was elsewhere. I am sure he can explain it better.
Stalled.

> > -  /* BEGIN PART ONE: Look for huts.  Non-Barbarian Ground units ONLY. */
> > +  /*
> > +   * PART 1: Look for huts
> > +   * Non-Barbarian Ground units ONLY.
> > +   */
> > +  
> 
> I prefer your way. It looks like time for a jehad on old style comments.
I didn't see similiar style anywhere else.

> >    if (!is_barbarian(pplayer)
> > -      && is_ground_unit(punit)) { /* boats don't hunt huts */
> > +      && is_ground_unit(punit)) {
> > +    /* Maximal acceptable move cost to the target */
> >      int maxcost = pplayer->ai.control ? 2 * THRESHOLD : 3;
> 
> You may want to add more stuff to README.AI on the wonders of threshold.
Did you or Ross already created a patch which adds stuff there? :)

> > +    /* Move cost to the best target (=> lower is better) */
> >      int bestcost = maxcost * SINGLE_MOVE + 1;
> 
> You did not explain why we add 1. It's so that we can find other paths
> that have the same movecost as the minimum cost one(due to djikstras).
> If you do this elsewhere, forget it.
I don't agree, I actually think it's much simpler - just this way we can
never trigger the goto, as bestcost is higher than maxcost * SINGLE_MOVE.
We don't reuse this value anywhere else so I don't think it has a deeper
mean.

> > +          && (!ai_handicap(pplayer, H_HUTS) || map_get_known(x1, y1,
> > pplayer))
> 
> A comment here saying which handicaps are affected by which ai difficulty
> levels may be handy. 
README.AI stuff. (read as "I'm too lazy to add this and don't like it here" ;)

Patch follows in reply to next comment.

-- 

                                Petr "Pasky" Baudis

UN*X programmer, UN*X administrator, hobbies = IPv6, IRC, FreeCiv, (e)links
.
The advantage of GUI is that you can see everything you can change.
The disadvantage of GUI is that you can change only what you can see.
.
Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/


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