[freeciv-ai] Re: (PR#4349) New tax code
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sat, 12 Jul 2003, Per I. Mathisen wrote:
> On Sat, 12 Jul 2003, Gregory Berkolaiko wrote:
> > Let's take the maxbuycost patch and criticise it step by step:
> >
> > +static void adjust_buylimit(struct player *pplayer, int by_how_much)
> > +{
> > +if (pplayer->economic.gold - pplayer->ai.est_upkeep
> > + < pplayer->ai.maxbuycost) {
> > + pplayer->ai.maxbuycost = MAX(pplayer->ai.maxbuycost, by_how_much);
> > +}
> > +}
> >
> > Naming is bad, but the worst is I don't understand the meaning of "if"
> > here. Per, please explain. You might need to lecture me on the general
> > use of maxbuycost too...
>
> maxbuycost is the amount of gold you want to have at hand next turn to buy
> stuff with. It is a gross and ugly hack that I did not give the axe since
> I did not have anything else to put in its place.
>
> The basic idea is that we may need to emergency buy _one_ thing next turn.
> Of course this is crap - we may have multiple emergencies! But anyway, it
> is better than not being able to handle any emergencies.
>
> If we have enough gold already that we can buy what we need, then we
> do not need to increase maxbuycost.
The logic of the "if" is flawed. If the current maxbuycost is less than
the gold we have we won't be able to increase it, no matter buyhowmuch.
Also, the way maxbuycost is taken into account in the tax code, we don't
need this "if".
> > The new code means that if an explorer walks into a city by chance, it's
> > dead. Nice...
>
> If it ends its movement in its _homecity_ by chance, yes... How often
> would that happen unintentionally?
Ugh I missed the homecity. Sorry.
> > The old code means that a production-1 cannot build itself a defender
> > unless it's urgent. Nice...
>
> This has nothing to do with building, and a prod-1 city can neither build
> nor upkeep an additional unit anyway.
But I saw it!!! Cities were buying war units and then disbanding them
straightaway.
> > - CITY_LOG(LOG_BUY, pcity, "Wonder being built in dangerous
> > position!");
> > + CITY_LOG(LOG_ERROR, pcity, "Wonder being built in dangerous
> > position!");
> >
> > Surely this is some artefact.
>
> Perhaps. This way we will find out.
Ok.
> > -if (pplayer->economic.gold + cached_limit < pplayer->ai.maxbuycost) {
> > - /* We have too much gold! Don't raise taxes */
> > - pplayer->ai.maxbuycost = 0;
> > -}
> > -
> >
> > What was that supposed to mean??
>
> The same as now done in adjust_buylimit().
But the sign here is wrong. Anyway, deleting it is ok.
G.
- [freeciv-ai] Re: (PR#4349) New tax code,
Gregory Berkolaiko <=
|
|