On 21.09.2012 06:49, Michael Vehrs wrote:
> On 20.09.2012 21:32, Lone_Wolf wrote:
>    
>>> On Thu, 20 Sep 2012 08:28:17 AM Michael Vehrs wrote:
>>>
>>>        
>>>> This looks like a rather hairy problem, since we are basically doing
>>>> everything right already. Except that in the case of starvation, we need
>>>> to look into the future.
>>>>
>>>>          
>>> The higher level fix (starve.diff) is still an option if you think the
>>> production code is doing the Right Thing, however ISTM that the problem is
>>> that the decision to build is too simplistic.  Rather than just `>= 200
>>> food',
>>> it should be `>= 200 + one-unit-consumption if net food production is
>>> -ve'.
>>> Not elegant I admit.
>>> Cheers,
>>> Mike Pope
>>>
>>> ----------------------------------------------------------------------------
>>>
>>>        
>> Disclaimer : i know little about Java code and haven't looked at /found
>> the production code mentioned.
>> I do suggest to compare the pseudocode below to the current food
>> production code.
>>
>>
>> * food increase when horses only eat grain
>>
>> food_grain  = caclulategrainproduction(colony)
>> food_fish = calculatefishproduction(colony)
>>
>> Food_needed = 2 * col_size
>> food_available = food_fish + food_grain - food_needed
>> if food_fish>   food_needed
>>       then
>>           food_horses = food_grain div 2
>>       else
>>           if food_available>   0
>>               then
>>                   food_horses = food_available div 2
>>               else
>>                   food_horses = 0
>>           endif
>> endif
>> food_increase = food_available - food_horses
>> addhorses(food_horses)
>> new_food_amount = current_amount + food_increase
>> if new_food_amond<   0
>>       then
>>           removecolonist(colony)
>>       else
>>           if new_food_amount>   200
>>               then
>>                   addnewcolonist(colony)
>>           endif
>> endif
>>
>>
>>
>> * food increase when horses do eat fish :
>>
>> food_grain  = caclulategrainproduction(colony)
>> food_fish = calculatefishproduction(colony)
>>
>> Food_needed = 2 * col_size
>> food_available = food_fish + food_grain - food_needed
>> if food_available>   0
>>       then
>>           food_horses = food_available div 2
>>       else
>>           food_horses = 0
>> endif
>>
>> food_increase = food_available - food_horses
>> addhorses(food_horses)
>> new_food_amount = current_amount + food_increase
>> if new_food_amond<   0
>>       then
>>           removecolonist(colony)
>>       else
>>           if new_food_amount>   200
>>               then
>>                   addnewcolonist(colony)
>>           endif
>> endif
>>
>>      
> Your code does not take mandatory food storage into account.
> Furthermore, it suffers from the same problem that causes the current
> starvation problem. It calculates whether there is enough food to
> produce a new colonist, whereas it should calculate whether there is
> enough food to produce *and feed* a new colonist.
>
> Regards
>
> Michael
>    

Actually, that's not true. I just realized that a new colonist is not 
automatically added to the colony that produces it, but remains on the 
colony tile. Therefore, the colonist does not need to be fed. This means 
the problem must be something else.

Regards

Michael



------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Freecol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to