Complete.Org: Mailing Lists: Archives: freeciv-ai: October 2002:
[freeciv-ai] Re: [Freeciv-Dev] AI hasn't build cities (1.14beta)
Home

[freeciv-ai] Re: [Freeciv-Dev] AI hasn't build cities (1.14beta)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: Jacek Popławski <jpopl@xxxxxxxxxx>, <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] Re: [Freeciv-Dev] AI hasn't build cities (1.14beta)
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 29 Oct 2002 14:25:39 +0000 (GMT)

On Tue, 29 Oct 2002, Gregory Berkolaiko wrote:
> I know I was very uncooperative lately, but still I think we better find
> the cause of the bug before plastering a patch on top.Otherwise we just
> bury the issue.
>
> If all goes well, I will have some free time tonight.Jacek, can you
> supply a savegame (as undeveloped as possible, as few AIs as possible)
> where this (mis-)behaviour is present.

Having tested this a little more, I now doubt whether this is actually a
new bug. The attached patch seems to fix the problem - by removing two
ai_fuzzy() calls from settlers.c.

The fundamental problem seems to be that you recalculate the best settler
spot every turn. This is what causes ai_fuzzy(), a later addition to the
AI code, to break the code and cause flip-flops: When the settler arrives
at the settling spot, it finds a slightly better spot and goes there
instead, and this can continue for a very long time since ai_fuzzy()
gives it sub-optimal settling spots.

However, this can also happen under non-easy conditions, since once it has
moved for one turn, it will search more territory for better settling
places, possibly leading to abandoning the first found optimal place, and
going for a long trek into the wilderness for new optimals.

So this isn't just one bug, it is a cluster of bugs that just came out of
the closet and I believe it is the small bugfix that is the kludge, while
the real solution is to actually fix the settling code.

The ideal from a bug-free-ness perspective is to commit this (v2) patch to
S1_14 and the first patch to head. However, this patch makes "easy"
difficulty a lot harder than it was previously.

  - Per

PS I am in principle opposed to the use of ai_fuzzy() since it makes the
code harder to read and leads to hard to find errors like this. Making the
AI easier isn't a hard problem and should be done right. ai_fuzzy()
clearly is a hack.

PPS The settlers.c code really ought to be rewritten from scratch. I've
made several attempts to do substantial improvements to it, but given up
because it is such a hopeless mess.

Attachment: settlersfixv2.diff
Description: Text document


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