public inbox for xconq7@sourceware.org
 help / color / mirror / Atom feed
* Calculating net material production
@ 2004-09-05 22:30 Lincoln Peters
  2004-09-06 18:51 ` Eric McDonald
  0 siblings, 1 reply; 2+ messages in thread
From: Lincoln Peters @ 2004-09-05 22:30 UTC (permalink / raw)
  To: Xconq list

I'm working on a new version of ai_plan_research.  So far, I've got a
fairly good idea of how to measure the worth of an advance by what units
it's required for and how it affects existing units*, but the key to
solving Elijah's problem with focusing advances is that the calculation
has to take into consideration the resources required to achieve that
advance.

I figure that the best way to do this is to look at the materials used
to gain the advance and the number of RP's required, calculate the rate
at which they're being produced (or at least being fed into the
treasury), and calculate the number of turns required to achieve that
advance.  Then I divide the calculated worth of the advance by the time
required.

Is there any code already in place to track such statistics?  Or will I
have to perform deeper code surgery to do this?


* So far, the weighting of an advance by new units it enables versus
existing units it affects is haphazard at best, but I hope to fix this
later (or at least make it fairly easy for someone else to fix).

---
Lincoln Peters
<sampln@sbcglobal.net>

Garbage In, Gospel Out

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Calculating net material production
  2004-09-05 22:30 Calculating net material production Lincoln Peters
@ 2004-09-06 18:51 ` Eric McDonald
  0 siblings, 0 replies; 2+ messages in thread
From: Eric McDonald @ 2004-09-06 18:51 UTC (permalink / raw)
  To: Lincoln Peters; +Cc: Xconq list

Lincoln Peters wrote:

> Is there any code already in place to track such statistics?  Or will I
> have to perform deeper code surgery to do this?

I think there is already something that sums up total materials 
possessed by a side. It is used in the materials display beneath the 
units type list in the Tcl/Tk interface. If the basic calculation behind 
this is not already in the kernel, then it could probably be moved 
there, and you could call it at the end of each turn and update some 
arrays (of length 'nummtypes') that would allow you to maintain a 
running average of the rates of production:
    m_prod_avg[m] += (m_at_turn_end[m] - m_at_last_turn_end[m]) / 2;
or something like that.

Eric

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-09-05 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-05 22:30 Calculating net material production Lincoln Peters
2004-09-06 18:51 ` Eric McDonald

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).