Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277
Home

[Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Mon, 25 Feb 2002 14:08:03 +0100

Dear diary, on Mon, Feb 25, 2002 at 01:22:27PM CET, I got a letter,
where Raahul Kumar <raahul_da_man@xxxxxxxxx> told me, that...
> > diff -u3NrX freeciv/diff_ignore freeciv/ai-old/aitools.c 
> > freeciv/ai/aitools.c
> > --- freeciv/ai-old/aitools.c        Sat Feb 23 14:19:06 2002
> > +++ freeciv/ai/aitools.c    Sun Feb 24 19:33:46 2002
> > @@ -47,7 +47,6 @@
> >  If (enemy != 0) it looks only for enemy cities
> >  If (pplayer != NULL) it looks for cities known to pplayer
> >  **************************************************************************/
> > -
> >  struct city *dist_nearest_city(struct player *pplayer, int x, int y,
> >                                 bool everywhere, bool enemy)
> >  { 
> > @@ -56,7 +55,7 @@
> >    int con = map_get_continent(x, y);
> >  
> >    players_iterate(pplay) {
> > -    if(enemy && pplay == pplayer) continue;
> > +    if ((enemy) && (pplayer) && (!pplayers_at_war(pplayer,pplay))) 
> > continue;
> >  
> 
> I don't understand the !pplayers_at_war. Enemy and pplayer should be enough.

Hm? And what about enemy cities known to you?

> >      city_list_iterate(pplay->cities, pcity)
> >        if (real_map_distance(x, y, pcity->x, pcity->y) < dist &&
> > diff -u3NrX freeciv/diff_ignore freeciv/ai-old/aiunit.c freeciv/ai/aiunit.c
> > --- freeciv/ai-old/aiunit.c Sun Feb 24 01:00:21 2002
> > +++ freeciv/ai/aiunit.c     Sun Feb 24 19:38:18 2002
> > @@ -1396,8 +1396,7 @@
> >  
> >  /* this is horrible, but I need to do something like this somewhere. --
> > Syela */
> >    players_iterate(aplayer) {
> > -    if (aplayer == pplayer) continue;
> > -    /* AI will try to conquer only enemy cities. -- Nb */
> 
> Petr is right about the comment still being right. What does the AI do
> when it runs out of enemies?

It wins.

> I'm willing to bet the AI never goes for the spacecraft win.

It somewhat understands the possibility to build a spaceship; and it does it
sometimes - however I'm not sure if it ever builds apollo itself and whether
desires for spaceship components aren't broken.

> > +    if (!pplayers_at_war(pplayer,aplayer)) continue;
> >      city_list_iterate(aplayer->cities, acity)
> >        city_reinforcements_cost_and_value(acity, punit);
> >        acity->ai.invasion = 0;
> > @@ -1755,7 +1761,7 @@
> >  }
> >  
> >  /*************************************************************************
> > -...
> > +  TODO: teach AI about trade routes with friendly players
> >  **************************************************************************/
> 
> I believe you said this was done. Kill that todo.

When? Where? :)

> >  static void ai_manage_caravan(struct player *pplayer, struct unit *punit)
> >  {
> > @@ -1820,7 +1826,6 @@
> >  When empty, it tries to find some units to carry or goes home or explores.
> >  Military units handled by ai_manage_military()
> >  **************************************************************************/
> > -
> >  static void ai_manage_ferryboat(struct player *pplayer, struct unit *punit)
> >  { /* It's about 12 feet square and has a capacity of almost 1000 pounds.
> >       It is well constructed of teak, and looks seaworthy. */
> 
> That comment is ridiculous. Kill it.

Don't!

> > @@ -2301,7 +2306,9 @@
> >      handicap = ai_handicap(pplayer, H_TARGETS);
> >      for( i = 0; i < game.nplayers; i++) {
> >        aplayer = &game.players[i];
> > -      if (aplayer == pplayer) continue;
> > +      /* ignore cities we are at peace with, assumes that there is
> > +         no need to establish embassy by the time we have peace */
> > +      if (!pplayers_at_war(pplayer, aplayer)) continue;
> >        /* sneaky way of avoiding foul diplomat capture  -AJS */
> >        has_emb=player_has_embassy(pplayer, aplayer) || pdiplomat->foul;
> >        city_list_iterate(aplayer->cities, acity)
> > 
> 
> I can see the use of an embassy. After all, the AI should not be satisfied
> to knock out the human player. It should go on to conquer the world. Former
> allies = tomorrows enemies.

Ack.

-- 

                                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]