Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] AI's advisors actually do stuff
Home

[Freeciv-Dev] AI's advisors actually do stuff

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] AI's advisors actually do stuff
From: "Baumans" <baumans@xxxxxxxxxxxxx>
Date: Tue, 27 Feb 2001 17:40:55 -0500

I've made a diff that tells the ai's advisors what to advise the ai to do.
It's pretty rudimentary, and right now the "wants" need to be tweaked and it
needs to have some of the techs that are wanted changed, and really added
to.



.--- advattitude.c.orig Tue Feb 27 16:56:52 2001
+++ advattitude.c Tue Feb 27 17:05:01 2001
@@ -14,6 +14,7 @@
 #include "city.h"
 #include "tech.h"

+#include "game.h"
 #include "aitools.h"

 #include "advattitude.h"
@@ -25,8 +26,12 @@
     the moment
 ***********************************************************************/

-void attitude_advisor_choose_tech(struct player *pplayer, struct ai_choice
*choice)
+void attitude_advisor_choose_tech(struct player *pplayer,
+      struct ai_choice *choice)
 {
+  choice->want = (total_player_citizens(pplayer)> 15 ||
pplayer->score.unhappy > 2) ? 25 : 5;
+  choice->choice = find_tech_by_name("Ceremonial Burial");/* for the
temples, of course*/
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
   choice->choice = A_NONE;
   choice->want   = 0;
   /* this function haven't been implemented yet */
--- advforeign.c.orig Sat Mar  4 06:52:15 2000
+++ advforeign.c Tue Feb 27 17:01:52 2001
@@ -13,8 +13,9 @@

 #include "city.h"
 #include "tech.h"
-
+#include "player.h"
 #include "aitools.h"
+#include "game.h"

 #include "advforeign.h"

@@ -27,8 +28,33 @@

 void foreign_advisor_choose_tech(struct player *pplayer,
      struct ai_choice *choice)
-{
+{
+  int fotherps = 0;
+  enum diplstate_type dpl;
+  players_iterate(other_player) /* any other civs found?*/
+   if (pplayer != other_player) {
+    dpl = pplayer_get_diplstate(pplayer,other_player)->type;
+    if (dpl != DS_NO_CONTACT) fotherps++;
+   }
+  players_iterate_end;
+
+  choice->want = ((fotherps) ? 10 : 20); /*TWEAK ME*/
+
+  choice->choice = find_tech_by_name("Horseback Riding");/*try to find more
civs*/
+  if (choice->choice <A_LAST && get_invention(pplayer,choice->choice)!=
TECH_KNOWN) return;
+
+  choice->choice = find_tech_by_name("Map Making");/* to trade maps(and
find civs) */
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
+
+  choice->want = ((fotherps) ? 10 : 5); /*TWEAK ME*/
+
+  choice->choice = find_tech_by_name("Writing"); /* Diplomats */
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
+
+  choice->choice = find_tech_by_name("Espionage");
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
+
   choice->choice = A_NONE;
   choice->want   = 0;
-  /* this function haven't been implemented yet */
+  /* this function should care about the current choice, but whatever */
 }
--- advscience.c.orig Tue Feb 27 16:22:30 2001
+++ advscience.c Tue Feb 27 17:05:56 2001
@@ -28,6 +28,19 @@
 void science_advisor_choose_tech(struct player *pplayer,
      struct ai_choice *choice)
 {
+
+  choice->want = 30;
+  choice->choice = find_tech_by_name("Monarchy");/* should be one of the
first goals */
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
+
+  choice->want = 10;
+  choice->choice = find_tech_by_name("Philosophy");/* extra tech */
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
+
+  choice->want = 15;
+  choice->choice = find_tech_by_name("Republic");/* another good government
*/
+  if (get_invention(pplayer,choice->choice) != TECH_KNOWN) return;
+
   choice->choice = A_NONE;
   choice->want   = 0;
   /* this function haven't been implemented yet */
--- advtrade.c.orig Mon Feb 26 18:11:04 2001
+++ advtrade.c Tue Feb 27 17:06:33 2001
@@ -27,6 +27,13 @@

 void trade_advisor_choose_tech(struct player *pplayer, struct ai_choice
*choice)
 {
+  choice->want = 20;
+  choice->choice = find_tech_by_name("Trade");/* pretty obvious, really */
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
+
+  choice->choice = find_tech_by_name("Map Making");/* to find civs to trade
with */
+  if (choice->choice < A_LAST && get_invention(pplayer,choice->choice) !=
TECH_KNOWN) return;
+
   choice->choice = A_NONE;
   choice->want   = 0;
   /* this function haven't been implemented yet */





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] AI's advisors actually do stuff, Baumans <=