Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have no idea if this question is correct for this forum, but I figured I'd give it a shot. I am trying to figure out the best order to execute skills in a game (I know). Anyway here is the skill information:

SkillName   SkillBar    CoolDown    ApproximateDuration Rank
Skill 1     2           40          2                   1
Skill 2     3           15          3.5                 2
Skill 3     3           7           3                   3
Skill 4     3           16          3.3                 4
Skill 5     3           12          3.9                 5
Skill 6     1           24          3.6                 6
Skill 7     1           10          1.7                 7

The Rank column indicates the priority of the skill (i.e. if it is off cool down the lowest rank (highest priority) skill should be run. What kind of math would be required to arrange these skills such that the skills are executed in the most efficient way? It's probably really simple and I will try to come up with something, but maybe one of you guys out there might find it interesting...?

Note: Each skill takes 'x' duration to execute (ApproximateDuration) which should be factored in.

Edit:

The following assumption(s) can be made at the beginning:

  • All of the skills will be off cooldown (usable).

Here is how I would start:

  1. Select all skills that are off cooldown and pull the lowest rank (highest priority) skill and run it.
  2. It has now executed Skill 1 which took 2 seconds to execute. Our total running time is 2 seconds and the cooldown on Skill 1 begins.
  3. Select all skills that are off cooldown and pull the lowest rank (highest priority) skill and run it.
  4. It has now executed Skill 2 which took 3.5 seconds to execute. Our total running time is 5.5 seconds and the cooldown on Skill 2 begins. Skill 1's cooldown is now at 38 seconds.
  5. Repeat... sort of? I guess this is the algorithm?
share|improve this question
    
Maybe you need to describe the rules in with some examples. –  Emmad Kareem Sep 28 '12 at 20:23
    
Over 15,540 seconds, you can execute rank 1 370 times, rank 2 840 times, and rank 3 777 times. Then, it crucially depends on how you value each rank. Looks like spamming rank 2 is your best bet in the long run, unless you value rank 1 more than twice rank 2. –  Legendre Sep 28 '12 at 20:26
    
There needs to be minimal pauses between skill uses. I can't afford to spam Skill 2 because that will leave a large gap in between skill uses. –  user43026 Sep 28 '12 at 20:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.