International Journal of Computer Games Technology / 2015 / Article / Alg 5

Research Article

Artificial Intelligence in Video Games: Towards a Unified Framework

Algorithm 5

DPS estimation of an ability chain. This function can be useful for creating optimal DPS plans.
double  calc_dps(AbilityChain & ac)
{
double  dmg = 0;
double  dur = 0;
AbilityChain::iterator a;
 //Add up the damage and duration of each ability in the chain
for  (a = ac.begin(); a != ac.end(); ++a)
 {
  dmg += (a)->damage();
  dur += (a)->usetime();
 }
 //DPS = total damage/total execution time
if  (zero(dmg))
  return  0;
if  (zero(dur))
  return  numeric_limits<double >::infinity();
return  dmg/dur;
}

We are committed to sharing findings related to COVID-19 as quickly as possible. We will be providing unlimited waivers of publication charges for accepted research articles as well as case reports and case series related to COVID-19. Review articles are excluded from this waiver policy. Sign up here as a reviewer to help fast-track new submissions.