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

[Freeciv-Dev] (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: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7249) Auto settlers don't irrigate or mine
From: "James Canete" <use_less@xxxxxxxxxxx>
Date: Sat, 31 Jan 2004 16:00:32 -0800
Reply-to: rt@xxxxxxxxxxx

<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

Attachment: fixautosettler2.diff
Description: Binary data


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