Complete.Org: Mailing Lists: Archives: freeciv-ai: November 2004:
[freeciv-ai] Re: (PR#8992) Patch: Building ferries
Home

[freeciv-ai] Re: (PR#8992) Patch: Building ferries

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] Re: (PR#8992) Patch: Building ferries
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Thu, 4 Nov 2004 20:25:37 -0800
Reply-to: rt@xxxxxxxxxxx

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

Benedict,

First of all, please accept my apologies for leaving you alone to struggle
with the ferry code.  I had a lot of work to do this month.

Secondly, I am very much impressed with your code.  But it is way too much
for the relatively simple task.  As Ali G put it, I got two words for you
"Keep it real!".

My experience in AI tells me that simple WAGs usually work at least as
good as long and complicated models.  Civ is a too complicated game to be
analyzed exactly.  As an example I can mention old settlers code which was
simulating city's growth and new code which doesn't do any simulations but
achieves, on average, better results.

To give another example from your code, you seem to take into account
projected journey length and modify the number of boats to be built
depnding on that.  An alternative approach would be to not care about it
(after all the computed journey length is a very inaccurate
approximation), build the boats few at a time and if the number of boats
will turn out to be insufficient, then the waiting customers will create
pressure on the system to build more boats.

Now what should be done.  The code in the present state is not commitable.
It's way to complicated and the gain is not obvious.  I suggest we
backtrack a lot and redo the patch with the original logic (it may be
simplistic but I tested it and it gave better results than the present
code).  We can leave some stub functions for future more complicated logic
(like new_boats_to_build) and functions like select_ferry_builders should
definitely stay.

We will commit the patch in its simplest form and then, if you wish, you
can make the logic more complicated and do some performance tests.

How does that sound?  If you agree, with your permission I will edit your
patch to my taste.

Thanks for your work!

Gr.

P.S. And we need to remove the word "desiradata" from the comment.


On Thu, 4 Nov 2004, Benedict Adamson wrote:

> Attached is the latest version of my centralised ferry building patch,
> based on Gregory Berkolaiko's original. This patch is applicable to the
> 2004-11-03 CVS development version.
>
> This differs from my previous versions of the patch as follows.
> * The AI can choose to switch cities that were building improvements or
> domestic units (units that do not want to go abroad) to ferry building,
> if the demand is great enough. Previously it would switch cities only if
> they were building units that themselves needed ferries. This is
> important when the demand for ferries is very great or there are many
> waiting passengers.
> * The AI can choose to build ferries in cities that would take a long
> time to complete them. This is important when the AI has plenty of gold.
> * Ever increasing numbers of waiting passengers increases the 'want'
> score for ferries. Previously that situation made the 'want' asymptote
> to 200, and could therefore cause the 'want' to decrease.
> * Removed the last vestiges of the 'straits' values. The AI now produces
> a less bogus guess for how enemy hunters will spread out to attack other
> players.
> * Removed the duplication of the sea_overlap_move function, as requested
> by Per.
> * Replaced bogus use of the pcity->ai.founder_want field with a new
> field, as requested by Per.
> * Replaced, with an enum, hard coded constants for the ferry building
> mode, as requested by Per.
> * Made it possible for the journey_length to vary from sea to sea
> (although it does not yet do so).
> * The selection of which cities will build ferries takes into account
> the 'want' scores of the cities, to avoid building in cities that have
> urgent non-ferry requirements.




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