| [freeciv-ai] (PR#9846) AI should count other players in it's territory[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
| To: | undisclosed-recipients: ; |  
| Subject: | [freeciv-ai] (PR#9846) AI should count other players in it's territory |  
| From: | "Mateusz Stefek" <mstefek@xxxxxxxxx> |  
| Date: | Sun, 29 Aug 2004 00:40:15 -0700 |  
| Reply-to: | rt@xxxxxxxxxxx |  
 
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9846 >
> [per - Sat Aug 28 17:52:04 2004]:
> 
> On Sat, 28 Aug 2004, Mateusz Stefek wrote:
> > This is improved version of James Camente's patch in PR#9006.
> > I think it's better to count units of allies too, because AI is too
> naive.
> >
> > I have tested it. With 3 units in ally's territorylove is about 50
> > (Enthusiastic)
> 
>     /* Reduce love by number of units in our territory.
> +     * AI is so naive, that we have to count it even if players are
> allied */
> +    pplayer->ai.love[aplayer->player_no] -=
> +      MIN(player_in_territory(pplayer, aplayer),
> +          pplayers_allied(aplayer, pplayer) ? 10 : BIG_NUMBER);
> 
> BIG_NUMBER here is pretty dumb. Use some lower and more sensible
> number
> instead, like, say, 50.
> 
>   - Per
Ok. There's also a better limit if players are allied
(diplomacy.love_incr - 1).
--
mateusz
> 
> 
 Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.27
diff -u -r1.27 advdiplomacy.c
--- ai/advdiplomacy.c   30 Jul 2004 20:40:49 -0000      1.27
+++ ai/advdiplomacy.c   29 Aug 2004 07:38:24 -0000
@@ -707,6 +707,13 @@
       }
       pplayer->ai.love[aplayer->player_no] -= ai->diplomacy.love_incr;
     }
+    /* Reduce love by number of units in our territory.
+     * AI is so naive, that we have to count it even if players are allied */
+    pplayer->ai.love[aplayer->player_no] -=
+      MIN(player_in_territory(pplayer, aplayer),
+          pplayers_allied(aplayer, pplayer) ? 
+           ai->diplomacy.love_incr - 1 : 50);
+         
     /* Massage our numbers to keep love and its opposite on the ground. 
      * Gravitate towards zero. */
     pplayer->ai.love[aplayer->player_no] -= 
 
 |  |