Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] Re: (PR#14923) Stupid AI Building Wants
Home

[Freeciv-Dev] Re: (PR#14923) Stupid AI Building Wants

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: badamson@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#14923) Stupid AI Building Wants
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 5 Mar 2006 14:23:03 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14923 >

On Mon, 27 Feb 2006, Benedict Adamson wrote:
> The result of these changes is a large patch (attached).

This patch is a 377k monster. It took me a while to read through. It has
lots of good stuff, and good documentation (yay!).

However, it is _a lot_ of new code. It must be split up as much as
possible.

In general, while I love the way you approach things, I think you try to
do too much. Covering every possibility and obscure twist of the rules
makes for tons of code that is hard to follow. It is too easy to add
subtle bugs of the wrong behavior kind all over the code. It is too hard
to maintain.

A few minor notes I made while reading:

advdiplomacy.c:
-  worth = bulbs + tech_want;
+  worth = bulbs + tech_want / TRADE_WEIGHTING;

is this wise?

What is the point with this...

+/**************************************************************************
+  Is this type of unit ever useful as a settler?
+**************************************************************************/
+static bool is_potential_settler(const struct unit_type *settler)
+{
+  return (unit_type_flag(settler, F_SETTLERS) &&
+         !unit_type_flag(settler, F_GAMELOSS) &&
+         0 < settler->move_rate);
+}

...I see several of these, and they seem completely pointless to me.

+static bool could_attack(const struct unit_type *attacker,
+                         const struct unit_type *defender)

Should be in common/combat.c

Code to second-guess what the hunter code might come up with? That is way
overkill. In general I think the AI should not attempt to guess what other
players may produce in the future. The AI is omniscient and we should use
that to find out what the player has and scramble to meet it as best we
can.

Perhaps we should think more about Greg's idea of statistically building
units of various types, and techs that will enable a wider and better
variety of types of units, so that the AI always has some units to play
around with; instead of looking too much into a crystal ball full of WAGs
to figure out what to build and research.

In ai_consider_attacker(), the attack_radius() function only looks a few
turns of unit movement outside the city. This will not do. The AI must be
able to attack far away targets too.

ai_citizen_want() is an interesting solution to a tough problem. I think I
like it, but I am not sure ;)

-       * For example, in the default ruleset a city must have a Library
+       * For example, in the default rule-set a city must have a Library

Err, no. A 'ruleset' is a technical term in Freeciv. It does not have a
hyphen :) Also 'space-race' is no more correct than spacerace. The correct
version is 'space race'. I think correcting it to be a waste of diff.

  - Per





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