Hammer overflow calculation

Blkbird

King
Joined
Oct 29, 2005
Messages
860
I'm building a library in a city with my state religion and forge, each of which gives +25% hammer. It has 24 base production and 21 hammer overflow from previous build, so:

Gross hammer output = floor((24 + 21) * (100% + 25% + 25%)) = floor(67.5) = 67

The library costs 60 hammers, so there's a gross overflow of 7, or:

Net hammer overflow = floor((7 / (100% + 25% +25%)) = floor(4.67) = 4

This is the actual calculation done by Civ4, but it's illogical. The logical calculation should be:

Net hammer cost = ceil(60 / (100% + 25% + 25%)) = ceil(20) = 20

Net hammer overflow = (24 + 21) - 20 = 5

In other words, only 19 hammers from base production is needed, which, together with 21 from previous build, are enough to finish the library, leaving an overflow of 5 hammers.

Civ4's current calculation is imprecise because it does the rounding twice instead of just once.
 
Back
Top Bottom