Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] Re: (PR#12834) amortize()
Home

[Freeciv-Dev] Re: (PR#12834) amortize()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bdunstan149@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12834) amortize()
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Apr 2005 14:56:35 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Brian Dunstan wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12834 >
> 
> I noticed that the amortize() function uses a very
> clever, but complicated, algorithm.  The reason
> apparently is to save time.  If that is the purpose,
> why not use a more transparent, but slower algorithm,
> and use it to make a lookup table?  Normal calls to
> amorize could just be reading an element from a 20- or
> 100-element integer array, which would be faster than
> what is there now.

One coder had the idea that ammortization is based on the inflation
rate, and this inflation rate changes with time.  We can calculate the
inflation rate based on certain factors - gold on hand (lower
inflation), danger/war (raises inflation), etc.  Then ammortize should
use this inflation rate.

There was a huge patch that completely redesigned the AI to do this sort
of thing - it's in RT somewhere.  For anyone interested in working on
this, I'd suggest ripping out the inflation calculation, and then using
it in ammortize.  We can use it elsewhere later of course.

-jason





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