| [Freeciv-Dev] Re: (PR#10127) AI does not build either farmland or Superm[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
 
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10127 >
Marko Lindqvist wrote:
><URL: http://rt.freeciv.org/Ticket/Display.html?id=10127 >
>
>Per I. Mathisen wrote:
>  
>
>>Both codes use rather general functions to do the checking, so one place
>>we have to add in some extra code with some wild guesses, perhaps based
>>on the amount of existing irrigation or the city's need for food or its
>>production capacity. I am not sure which code should be responsible for
>>anticipating the actions of the other.
>>    
>>
>
>  Supermarket has upkeep cost even if there is no farmland around. 
>Farmland without supermarket has no such bad effects.
>  
>
A supermarket without any farmland still increases the amount of food
produced by the city tile (I think),  so it is beneficial if a city is
eating more food than it produces.
>  Also, situation may change so that once we have finished first part of 
>farmland+supermarket, there can be more urgent things to do than 
>finishing second part. So it's possible that we never get any benefit 
>from first part. I think that we have more worker capacity than building 
>capacity to spent in such somewhat risky investments.
>  
>
I suppose the AI could consider farmland if a city is already building a
supermarket, or if the city worklist includes a supermarket.  If there
are workers or engineers available, or they will become available in the
next turn, and tiles used by the city already have irrigation, AI could
begin building a supermarket.
if (city_would_benefit_from_farmland_if_it_had _supermarket(pcity) &&
turns_to_build_farmland_near_city(pcity) < 5) { // build supermarket }
if (city_would_benefit_from_farmland_if_it_had _supermarket(pcity) &&
pcity->currently_building == B_SUPERMARKET) { // build farmland near 
city }
 
 |  |