> 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



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Freecol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to