Complete.Org: Mailing Lists: Archives: freeciv-ai: January 2003:
[freeciv-ai] Re: (PR#2644) AI needs 5400 years to get Republic
Home

[freeciv-ai] Re: (PR#2644) AI needs 5400 years to get Republic

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ue80@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#2644) AI needs 5400 years to get Republic
From: "Per I. Mathisen via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 27 Jan 2003 11:30:47 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Sun, 26 Jan 2003, ue80@xxxxxxxxxxxxxxxxxxxxx via RT wrote:
> > > I just want to remind you that this problem was also observed in the
> > > first contest. With a high research cost the AI didn't research any
> > > tech which would enable it to build good units and so it built
> > > baracks. This also wasted all trade -> 100% tax and no science.
> >
> > Ok, i think its the fallback where AI builds only barracks and settlers
> > when it doesn't know what to build. Think we should change it to another
> > fallback.
>
> And here the new fallback:

Thanks, this is better. I modified it a little and commited it. The
modified patch is attached.

  - Per

Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.136
diff -u -r1.136 aicity.c
--- ai/aicity.c 27 Jan 2003 19:19:04 -0000      1.136
+++ ai/aicity.c 27 Jan 2003 19:27:38 -0000
@@ -257,19 +257,22 @@
     return;
   } /* AI cheats -- no penalty for switching from unit to improvement, etc. */
 
-  /* fallbacks should never happen anymore, but probably
-     could somehow. -- Syela */
+  /* I think fallbacks only happen with techlevel 0, and even then are rare.
+   * I haven't seen them, but I want to somewhat prepare for them anyway. 
+   * -- Syela */ 
+  /* Yes, they do happen with techlevel 0, which is now default. -- Per */
   freelog(LOG_VERBOSE, "Falling back - %s didn't want soldiers, settlers,"
                        " or buildings", pcity->name);
-  if (can_build_improvement(pcity, B_BARRACKS)) {
-    pcity->currently_building = B_BARRACKS;
+  if (best_role_unit(pcity, F_TRADE_ROUTE) != U_LAST) {
+    pcity->currently_building = best_role_unit(pcity, F_TRADE_ROUTE);
+    pcity->is_building_unit = TRUE;
+  } else if (can_build_improvement(pcity, B_CAPITAL)) {
+    pcity->currently_building = B_CAPITAL;
     pcity->is_building_unit = FALSE;
-  } else {
-    pcity->currently_building = best_role_unit(pcity, F_SETTLERS); /* yes, 
this could be truly bad */
+  } else if (best_role_unit(pcity, F_SETTLERS) != U_LAST) {
+    pcity->currently_building = best_role_unit(pcity, F_SETTLERS);
     pcity->is_building_unit = TRUE;
   }
-/* I think fallbacks only happen with techlevel 0, and even then are rare.
-I haven't seen them, but I want to somewhat prepare for them anyway. -- Syela 
*/  
 }
 
 /************************************************************************** 

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