Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2004:
[freeciv-ai] (PR#10146) new handicap: H_DIPLOMACY
Home

[freeciv-ai] (PR#10146) new handicap: H_DIPLOMACY

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] (PR#10146) new handicap: H_DIPLOMACY
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Fri, 17 Sep 2004 10:38:26 -0700
Reply-to: rt@xxxxxxxxxxx

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

Also make novice AI player less agressive against human players.
--
mateusz
? freeciv.spec
? ai/test
? client/civgame-3950.sav.gz
? server/civgame-3700.sav.gz
? server/civgame-3900.sav.gz
? server/civgame-3950.sav.gz
? server/freeciv_user_database
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.42
diff -u -r1.42 advdiplomacy.c
--- ai/advdiplomacy.c   17 Sep 2004 08:35:14 -0000      1.42
+++ ai/advdiplomacy.c   17 Sep 2004 17:32:59 -0000
@@ -372,7 +372,12 @@
       /* Very silly algorithm 1: Sea map more worth if enemy has more
          cities. Reasoning is he has more use of seamap for settling
          new areas the more cities he has already. */
-      worth -= 25 * city_list_size(&aplayer->cities);
+      worth -= 15 * city_list_size(&aplayer->cities);
+
+      /* Make maps from novice player cheap */
+      if (ai_handicap(pplayer, H_DIPLOMACY)) {
+        worth /= 2;
+      }
     }
     break;
 
@@ -383,10 +388,14 @@
     } else {
       /* Very silly algorithm 2: Land map more worth the more cities
          we have, since we expose all of these to the enemy. */
-      worth -= 75 * MAX(city_list_size(&pplayer->cities), 3);
+      worth -= 50 * MAX(city_list_size(&pplayer->cities), 3);
       /* Inflate numbers if not peace */
       if (!pplayers_in_peace(pplayer, aplayer)) {
-        worth *= 3;
+        worth *= 4;
+      }
+      /* Make maps from novice player cheap */
+      if (ai_handicap(pplayer, H_DIPLOMACY)) {
+        worth /= 6;
       }
     }
     break;
@@ -654,6 +663,11 @@
                         * pplayer->ai.love[aplayer->player_no] 
                         / 2000);
 
+  /* Make novice AI more peaceful for human players */
+  if (ai_handicap(pplayer, H_DIPLOMACY) && !aplayer->ai.control) {
+    kill_desire = kill_desire / 2 - 10;
+  }
+
   /* Amortize by distance */
   return amortize(kill_desire, adip->distance);
 }
Index: common/player.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.h,v
retrieving revision 1.126
diff -u -r1.126 player.h
--- common/player.h     17 Sep 2004 08:35:14 -0000      1.126
+++ common/player.h     17 Sep 2004 17:33:01 -0000
@@ -53,7 +53,8 @@
   H_HUTS = 128,       /* Doesn't know which unseen tiles have huts on them */
   H_FOG = 256,        /* Can't see through fog of war */
   H_NOPLANES = 512,   /* Doesn't build air units */
-  H_MAP = 1024        /* Only knows map_is_known tiles */
+  H_MAP = 1024,       /* Only knows map_is_known tiles */
+  H_DIPLOMACY = 2048  /* Not very good at diplomacy */
 };
 
 struct player_economic {
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.350
diff -u -r1.350 stdinhand.c
--- server/stdinhand.c  17 Sep 2004 03:37:10 -0000      1.350
+++ server/stdinhand.c  17 Sep 2004 17:35:35 -0000
@@ -620,7 +620,8 @@
   int h[11] = { -1,
                H_AWAY,
  /* novice */   H_RATES | H_TARGETS | H_HUTS | H_NOPLANES 
-                        | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE,
+                        | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
+                       | H_DIPLOMACY,
  /* easy */    H_RATES | H_TARGETS | H_HUTS | H_NOPLANES 
                         | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE,
                H_NONE,

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