Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#11907) a better init_min_production
Home

[Freeciv-Dev] (PR#11907) a better init_min_production

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#11907) a better init_min_production
From: "Benoit Hudson" <bh@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 4 Mar 2005 20:42:30 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11907 >

> [jdorje - Wed Jan 12 22:01:06 2005]:
> 
> This patch rewrites init_min_production.

I just noticed this (and decided really I should actually subscribe to 
freeciv-dev).

This is nice.  I clearly remember back when I wrote this function
thinking how useful it'd be to have a usage[] array :)

I haven't carefully considered the rounding issue;
I didn't want to back when I wrote the first implementation,
which is why I stuck with floating-point.  I don't have time
to check it now.

Two bugs stand out:

(1) minor
+       min -= pcity->trade_value[i];
This doesn't do what you want it to: optimizing may
yield higher-value trade routes.  As always, trade routes
are tricky.  Under the current code, trade routes depend only
on trade, so we could complete a solution maximizing trade
and then use the trade_value.  That uses the assumption that
trade route values depend only on trade, but probably that'll
be valid for a while (a priori, there's no reason to have that:
trade routes could quite reasonably be based on shields).

(2) possibly critical
Gold doesn't seem to depend on trade.  How can this be?
This is bad in the client where the gold constraint matters;
it'd be invisible in the server (so an all-AI game wouldn't
notice it).  Same goes for lux and sci, but those are basically
never critical constraints.

Finally, you've made the comment that this is fragile code
because it makes assumptions about the city.c code.  I
agree, but I think it's less fragile than what I wrote.



[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11907) a better init_min_production, Benoit Hudson <=