Summary: Possible bug in ai_manage_taxes (aihand.c)
Submitted by: bardo
Submitted on: lun 13 ago 2012 16:07:26 GMT
Severity: 3 - Normal
Priority: 5 - Normal
Assigned to: None
Discussion Lock: Any
Operating System: None
For long time I have noticed the AI does not set the tax rates properly.
I have seen AIs that set a percentage to luxuries when there are no unhappy
people and there is no chance to celebrate, and I have seen many times the AI
losing buildings due to low funds when it was possible to increase the gold
taxes and so avoid the banckrupt.
At first I thought the wrong behavior was related to units supported by gold
(I have reported it in other tickets), but I have revised the related AI code
and I think I have found a possible bug in ai_manage_taxes (aihand.c):
/* First set tax (gold) to the minimal available number */
rates[AI_RATE_SCI] = maxrate; /* Assume we want science here */
rates[AI_RATE_TAX] = MAX(0, 100 - maxrate * 2); /* If maxrate < 50% */
rates[AI_RATE_LUX] = (100 - rates[AI_RATE_SCI] - rates[AI_RATE_TAX]);
I can't understand the reason why maxrate is multiplied by 2 in:
>rates[AI_RATE_TAX] = MAX(0, 100 - maxrate * 2)
And such bug would cause the often AI behavior that I see where AI sets taxes
to 60% science, 0% gold and 40% luxuries at start.
When I "fix" it and I recompile, I find the tax rates are set by the AI in a
more reasonable way (with no useless luxuries), but AI still seems unable to
handle low of funds situations.
I'm new to freeciv code and I'm not sure if I really fixed something, or I
introduced an error that looks like an improvement. I'll try to upload some
savegame in case some coder can take a look.
Date: lun 13 ago 2012 16:07:26 GMT Name: AItaxRates.diff Size: 940B By:
Reply to this item at:
Mensaje enviado vía/por Gna!
Freeciv-dev mailing list