Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2004:
[freeciv-ai] (PR#9812) AI.love lacks specification
Home

[freeciv-ai] (PR#9812) AI.love lacks specification

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] (PR#9812) AI.love lacks specification
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sun, 29 Aug 2004 00:03:50 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9812 >

> [per - Sat Aug 28 10:18:04 2004]:
> 
> On Sat, 28 Aug 2004, Mateusz Stefek wrote:
> > > [mstefek - Wed Aug 25 19:20:48 2004]:
> > >
> > > AI.love should mean some absolute value in some well defined unit.
> > > Because:
> > > - It's saved in savegame
> > > - It is used by client
> > > - We want to understand it
> > >
> > > --
> > > mateusz
> > >
> > I think we can agree on a range [-100..100].
> 
> I agree. You may want to change the love coeff and incr values to match.
> 
>   - Per
Ok. This patch changes coeff to 4%. Now the fixed points are -96 and 96
instead of -76 and 76.
I also changed ranges in love_text() to better fit new values.
--
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 06:58:34 -0000
@@ -711,6 +711,10 @@
      * Gravitate towards zero. */
     pplayer->ai.love[aplayer->player_no] -= 
        (pplayer->ai.love[aplayer->player_no] * ai->diplomacy.love_coeff / 100);
+       
+    /* ai love should always be in range [-100..100] */
+    pplayer->ai.love[aplayer->player_no] = 
+      MAX(-100, MIN(100, pplayer->ai.love[aplayer->player_no]));
   } players_iterate_end;
 
   /* Stop war against a dead player */
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.31
diff -u -r1.31 aidata.c
--- ai/aidata.c 13 Aug 2004 15:59:11 -0000      1.31
+++ ai/aidata.c 29 Aug 2004 06:58:37 -0000
@@ -361,7 +361,7 @@
   ai->diplomacy.strategy = WIN_OPEN;
   ai->diplomacy.timer = 0;
   ai->diplomacy.countdown = 0;
-  ai->diplomacy.love_coeff = 5; /* 5% */
+  ai->diplomacy.love_coeff = 4; /* 4% */
   ai->diplomacy.love_incr = 4;
   ai->diplomacy.req_love_for_peace = 8;
   ai->diplomacy.req_love_for_alliance = 16;
Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.147
diff -u -r1.147 player.c
--- common/player.c     27 Aug 2004 17:36:53 -0000      1.147
+++ common/player.c     29 Aug 2004 06:58:38 -0000
@@ -590,28 +590,28 @@
 **************************************************************************/
 const char *love_text(const int love)
 {
-  if (love <= -81) {
+  if (love <= -95) {
     return Q_("?attitude:Genocidal");
-  } else if (love >= -80 && love <= -61) {
+  } else if (love >= -94 && love <= -71) {
     return Q_("?attitude:Belligerent");
-  } else if (love >= -60 && love <= -41) {
+  } else if (love >= -70 && love <= -51) {
     return Q_("?attitude:Hostile");
-  } else if (love >= -40 && love <= -21) {
+  } else if (love >= -50 && love <= -25) {
     return Q_("?attitude:Uncooperative");
-  } else if (love >= -20 && love <= -6) {
+  } else if (love >= -24 && love <= -11) {
     return Q_("?attitude:Uneasy");
-  } else if (love >= -5 && love <= 5) {
+  } else if (love >= -10 && love <= 10) {
     return Q_("?attitude:Neutral");
-  } else if (love >= 6 && love <= 20) {
+  } else if (love >= 11 && love <= 24) {
     return Q_("?attitude:Respectful");
-  } else if (love >= 21 && love <= 40) {
+  } else if (love >= 25 && love <= 50) {
     return Q_("?attitude:Helpful");
-  } else if (love >= 41 && love <= 60) {
+  } else if (love >= 51 && love <= 70) {
     return Q_("?attitude:Enthusiastic");
-  } else if (love >= 61 && love <= 80) {
+  } else if (love >= 71 && love <= 94) {
     return Q_("?attitude:Admiring");
   } else {
-    assert(love >= 81);
+    assert(love >= 95);
     return Q_("?attitude:Worshipful");
   }
 }

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