
March 3rd, 2004, 12:31 AM
|
 |
Major General
|
|
Join Date: Oct 2003
Location: Crystal Tokyo
Posts: 2,453
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: Better, Simpler Programming Contest
MORE GENERIC CONTEST RESTATEMENT
You have 3 resource types (gold, res, and holy), and some number (n) of units. Each unit and resource has a specified value.
The goal: Make a production queue that maximizes value, within resource constraints.
Example:
Your province has the following resources:
Gold 120, Res 88, Holy 4
This is specified in the input file like this:
code:
resourcetypes=3
resource=gold quantity=120 value=-1
resource=res quantity=88 value=1
resource=holy quantity=4 value=10
The province can produce 4 types of units, named a, b, c, and d. They are specified in the input file like this:
code:
unittypes=4
unitname=a gold=5 res=3 holy=0 value=5
unitname=b gold=7 res=12 holy=0 value=8
unitname=c gold=12 res=2 holy=1 value=17
unitname=d gold=22 res=21 holy=0 value=15
The program will find a combination of a, b, c, and d that maximizes value. In this example, you get 5 points for building each "a" and 17 points for building each "c". You also get 1 point for using each "res", 10 points for using each "holy", and lose a point for using each "gold".
In other words, your total score, for this input, would be:
5*(#a built)+8*(#b built)+17*(#c built)+15*(#d built)-1*(#gold used)+1*(#res used)+10*(#holy used)
Sample Output:
code:
a=3, b=1, c=4, d=1
gold=92, res=50, holy=4
value=104
(these resource numbers indicate the number used)
value=15+8+68+15-92+50+40=104, unless I made an error.
The score would then be calculated according to the equation, with a higher score better. The value of resources and units would, thus, be arbitrary, so that the algorithm could be used to optimize the queue for any resource-using game!
[ March 03, 2004, 06:24: Message edited by: Saber Cherry ]
|