Complete.Org: Mailing Lists: Archives: freeciv-ai: April 2002:
[freeciv-ai] Re: README.AI

[freeciv-ai] Re: README.AI

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: README.AI
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Apr 2002 20:40:31 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Apr 29, 2002 at 07:08:06PM +0100, Gregory Berkolaiko wrote:
> Expanded version attached.
> Wrote Amortize and added Estimation of battle profit sections.
> Added a couple of bugs.  Added "things worked upon" section.  Added a 
> suggestion on struct choice.

> Tried to avoid formatting other peoples text.  But I really wanted to add 
> double line interval between different sections.

Why don't you do it?

> ============ 
> The Freeciv AI is widely recognized as being as good as or better
> militarywise as the AI of certain other games it is natural to compare
> it with. It does, however, lack diplomacy and can only do war. It is
> also too hard on novice players and too easy for experienced players.
> The code base is not in a good state. It has a number of problems,
> from very messy and not very readable codebase, to many missing
> features to some bugs, which aren't easy to fix due to unreadable
> code. The problem is, that most the code was written by someone who
> didn't care about code readibility a lot. After he left the project,
> various people have contributed their own mostly unfinished hacks
> without really fixing the main issues in the AI code, resulting in
> even more mess.
>   Another problem is that not all code is residing in ai/ (which is
> currently still linked to a server, but there're plans to separate
> this completely to some kind of client, working name is "civbot"),
> but it is also dissolved in little chunks in the whole server/.
> Aside that, server/settlers.c is only AI stuff - the problem is,
> that most of it is used also for the autosettlers, so we can't
> separate it from the server.
>   This file aims to describe all such problems, in addition to various
> not entirely self-describing constants and equations used in the code
> commonly.

Either indent all sections with two spaces or none.

> ========
> Hard fact:
> amortize(benefit, delay) returns benefit * ((MORT - 1)/MORT)^delay
> (where ^ = to the power of)
> Speculation:
> What is better, to receive 10$ annually starting 5 years from now or
> 5$ annually starting from this year?  The function amortize is

"now" and "this year" is the same for me.

> meant to help you answer this question.  To achieve this, it rescales
> the future benefit in terms of todays money.
> Suppose we have a constant rate of inflation, x percent.  Then in five
> years time 10$ will buy as much as 10*(100/(100+x))^5 $ will buy
> today.  Denoting 100/(100+x) by q we get the general formula, N$ in Y
> years time will be equivalent to N*q^Y in todays money.  If we will
> receive N$ every year starting Y years from now, the total amount
> receivable (in todays money) is 

Please drop the $. They make it hard to read.

>            N*q^Y + N*q^{Y+1} + N*q^{Y+2} + ...  
>            = N*q^Y * (1 + q + q^2 + q^3 + ...)  
>            = N*q^Y / (1-q) 
> Here we used the formula for the sum of geometric series.  Note that
> the factor 1/(1-q) does not depend on the parameters N and Y and can
> be ignored.  In this setting, the current value of MORT = 24
> corresponds to the inflation rate (or rate of expansion of your civ)
> of 4.3%
> Most likely this explanation is not what the authors of amortize() had
> in mind, but the basic idea is correct: the value of the payoff decays
> exponentially with the delay.
> The version of amortize used in military code (military_amortize())

> remains a complete mistery.

> ==============================================
> This estimation is implemented by kill_desire function (which isn't
> perfect: multi-victim part is flawed) plus some corrections.  In
> general,
>         Want = Operation_Profit * Amortization_Factor
> where 
> * Amortization_Factor is completely beyond me (but it's a function of the
> estimated time length of the operation).
> * Operation_Profit = Battle_Profit - Maintenance
> where
> * Maintenance 
>   = (1 shield + Unhappiness_Compensation) * Operation_Time 
>   (here unhappiness is from military unit being away from home)  

And for what is the shield?


 email: rf13@xxxxxxxxxxxxxxxxx
 "This is Linux Country. On a quiet night, you can hear Windows reboot."

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