Game Development Reference
In-Depth Information
Utility = ( NoAttack * -mTowerCost )
+ ( OddsSmallAttack * -( mTowerCost + mSmallDamageTower ) )
+ ( OddsLargeAttack * -( mTowerCost + mLargeDamageTower )
);
return Utility;
}
float MyGame::UtilityNoTower( float OddsLargeAttack, float
OddsSmallAttack )
{
// Returns the utility value of not purchasing the tower using
// alternate attack odds
float Utility;
Utility = ( OddsSmallAttack * -mSmallDamageNoTower )
+ ( OddsLargeAttack * -mBarracksCost );
return Utility;
}
bool MyGame::BuildTower( float OddsLargeAttackTower,
float OddsLargeAttackNoTower,
float OddsSmallAttackTower,
float OddsSmallAttackNoTower )
{
// Returns the decision on whether or not to purchase the
// tower based on the relative utility values returned from
// the two functions - including the different odds of attacks
// on the barracks based on the presence of the tower.
float thisUtilityTower;
float thisUtilityNoTower;
Search WWH ::




Custom Search