Thread Tools
Old March 10, 2002, 08:37   #1
Xin Yu
Apolytoners Hall of Fame
King
 
Xin Yu's Avatar
 
Local Time: 13:31
Local Date: October 31, 2010
Join Date: Dec 1969
Location: Emeryville, CA, USA
Posts: 1,658
Please help me finalize rush buying formula
My Civmanager Program is almost ready except that I am not confident about rush buying formula. Here's the variables to be considered:

Building Item Type (1=unit, 2=improve,3=wonder)
Building Item Total Shield (multiplied by 10 or user input number at the beginning of rules.txt)
Available intermediate building items and their Shield Costs.
Money needed to buy incrementally.

I have all the above variables figured out. However I'm not sure I have found the minimum cost in money to buy a unit. This is because that one can first buy an improvement then switch to unit, or vise versa. Can anybody help? (Well, it is one of the rare situations when a PhD in math needs help in a math question.
Xin Yu is offline  
Old March 15, 2002, 05:04   #2
ravagon
Scenario League / Civ2-Creation
King
 
Local Time: 05:31
Local Date: November 1, 2010
Join Date: Sep 1999
Location: Australia
Posts: 1,515
Depending upon what you were buying though, you'd only ever consider rushing a unit/building/wonder(!?) in the first increment before changing type as doing so further down the line would result in halving your accumulated production. Hence you'd only check for the first increment... Or am I misunderstanding the question?
ravagon is offline  
Old March 15, 2002, 13:35   #3
Xin Yu
Apolytoners Hall of Fame
King
 
Xin Yu's Avatar
 
Local Time: 13:31
Local Date: October 31, 2010
Join Date: Dec 1969
Location: Emeryville, CA, USA
Posts: 1,658
Thanks, ravagon. Let's narrow down my problem.

a) We don't need to automate buying wonders since they are so rare.
b) We have two situations when buying a city improvement: if there have been some shields accumulated, then buy it directly; if no shields have been accumulated then we first buy the cheapest improvement or the cheapest unit, then buy the full shield box. A comparison will be made between the two options to pick the cheapest price.
c) Things are more complicated when buying a unit. We need to compare the cost of incremental buying for units with all 'one time shot' switching approach (i.e., switch to improvement, buy certain shields then switch back. The optimum number of shields buying on the improvement part can be obtained when we exhaust the list). We don't want to switch for more than once, for the reason you mentioned.

Did we miss something? Yes. What if your city can produce certain amount of shields each turn and you don't want to buy the whole thing? This will greatly impact calculations in parts b) and c).
Xin Yu is offline  
Old March 16, 2002, 04:19   #4
ravagon
Scenario League / Civ2-Creation
King
 
Local Time: 05:31
Local Date: November 1, 2010
Join Date: Sep 1999
Location: Australia
Posts: 1,515
Quote:
Originally posted by Xin Yu

Did we miss something? Yes. What if your city can produce certain amount of shields each turn and you don't want to buy the whole thing? This will greatly impact calculations in parts b) and c).
I didn't realize you were implementing this as well. That would complicate things somewhat.
Is this intended for use in scenario's with units (potentially) exceeding the 240 shield limit, beyond which rush buying becomes ... problematic?

As far as I can see the basic solution will be to order the production possibilities available for both improvements and units separately and by increasing price. Hence the key indicator will be the price differential between sequential "products"relative to the overall cost. ie: If the price "jump" to the next higher element in the desired queue exceeds that of incrementally buying up in the adjacent queue (accounting for the loss in switching production) then that particular step should be rejected.
Not quite this simple of course as the position of the adjacent elements in the overall shield requirement is the most crucial thing. Is there a detailed "price-map" of shield cost for the remaining shields relative to the proportion already accumulated? The only factual (?) info I have on it is the 240 shield cycle and the diminishing return effect the closer you are to starting from scratch.

I can't quite see why the rush-buying of an improvement for the cheapest possible cost wouldn't have the same problems as that of rush-buying a unit though...

Now I'm getting a headache
ravagon is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 17:31.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team