[Freeciv-Dev] Re: Patch: generalized granary size (PR#635)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sunday 24 December 2000 22:49, Andrew McGuinness wrote:
> On Sun, Dec 24, 2000 at 03:29:08PM +0000, Andrew McGuinness wrote:
> > The values fixed in correspond to 76 / city_size, except that the value
> > for size 1 is 57 instead of 76. This looks like a manual tweak.
> >
> > As Thue points out, prior to May 1999, fooxbox_width was = city_size.
> > (instead of city_size+1)
> >
> > What this means is that prior to the May 1999 change,
> > the AI valued each unit of city growth the same, except that
> > getting size 2 was worth only 3/4 as much
> > (because of the first value being 57 instead of 76).
>
> Also, the value for city size 1 is not used much in the code.
> The only places where it is used are for settler actions and
> for setting tax and luxury rates. Everywhere else food_weighting
> is called with food_weighting( MAX( 2, citysize)) or
> food_weighting( MAX( 3, citysize )). So, the AI seems to be
> assuming for most purposes that the city will grow to size 2
> or 3 soon anyway. This makes the 57 instead of 76 of less
> significance.
>
> So, it is consistent with how the code originally was to make
> food_weighting(cs) return (5*FOOD_WEIGHTING)/(cs+1), exactly as
> Thue said, except that food_weighting(1) should be 36 instead
> of 48, for what it's worth.
Well, actually the code was optimized for size 4 cities, which then had a
food_box width of 4, so that would be better to use than 5...
And it would not be correct just to copy the way to handle size 1 cities
relative to size 2 cities, since that relationship have changed. Actually I
think we need some way to weight food value as a composite of the value in
the city immediately and how much it will be worth later. That would include
the special case of size 1 cities that didn't stay size one very long.
And finally, the code I posted (which was just a schetch) need to use
floating point numbers to handle that division correct.
Oh, and I noticed some hardcoded uses of the foodbox width in
ai/advdomestic.c:ai_eval_buildings(). Did you catch them Mike?
-Thue
|
|