Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7249) Auto settlers don't irrigate or mine
Home

[Freeciv-Dev] Re: (PR#7249) Auto settlers don't irrigate or mine

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: use_less@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7249) Auto settlers don't irrigate or mine
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Sun, 1 Feb 2004 16:30:48 -0800
Reply-to: rt@xxxxxxxxxxx

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

James,

You seem to have understood the meaning of the variables in 
consider_settler_action.  How about rewriting it to give the variables 
more descriptive names, to comment the actions taken and the function 
itself.

G.

P.S. There is a "explanation" of amortize in
        http://www.freeciv.org/lxr/source/doc/README.AI#L81
which is quite similar to your math below.

On Sat, 31 Jan 2004, James Canete wrote:

> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7249 >
> 
> I made a patch based on my post above, so I'd better explain what
> exactly my math is.
> 
> if:
> b = difference in improvement value
> m = discount per turn, defined in amortize() as (MORT-1)/MORT
> t = time to create improvement
> a = amortized value of one time payment after t
> v = total value
> 
> then a = bm^t
> 
> however this isn't quite right, since the value is paid every turn
> thereafter, so v = bm^t + bm^(t+1) + bm^(t+2) + ...
> 
> we can factor this into v = bm^t ( 1 + m + m^2 + m^3 + ... )
> 
> and the sum of the infinite series (1 + m + m^2 + m^3 + ... ) is equal
> to 1 / (1 - m), assuming m<1.
> 
> and so the final value of v is a / (1 - m), which is in the patch.
> 
> The patch also includes the "if extra == -1, extra = 0" clause.
> 
> Anyone want to check my math? :)
> -James Canete
> 




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