Stamina Class Reference

#include <Objects.h>


Public Member Functions

 Stamina (double dSta=4000.0, double dEff=1.0, double dRec=1.0)
void show (ostream &os=cout)
TiredNessT getTiredNess (double dRecDecThr, double dStaminaMax)
double getStamina () const
bool setStamina (double d)
double getEffort () const
bool setEffort (double d)
double getRecovery () const
bool setRecovery (double d)

Private Attributes

double m_dStamina
double m_dEffort
double m_dRecovery


Detailed Description

The following stamina information is stored in this class.

Definition at line 291 of file Objects.h.


Constructor & Destructor Documentation

Stamina::Stamina ( double  dSta = 4000.0,
double  dEff = 1.0,
double  dRec = 1.0 
)

This is the constructor for this class. It sets the stamina, effort and recovery on the supplied values.

Parameters:
dSta new stamina value (default 4000.0)
dEff new effort value (default 1.0)
dRec new recovery value (default 1.0)

Definition at line 1073 of file Objects.cpp.

References setEffort(), setRecovery(), and setStamina().


Member Function Documentation

void Stamina::show ( ostream &  os = cout  ) 

This method prints the stamina values (stamina, effort and recovery) to the specified output stream.

Parameters:
os output stream

Definition at line 1083 of file Objects.cpp.

References m_dEffort, m_dRecovery, and m_dStamina.

Referenced by AgentObject::show().

TiredNessT Stamina::getTiredNess ( double  dRecDecThr,
double  dStaminaMax 
)

This method returns a TiredNessT enumeration that indicates how tired this associated agent with this Stamina value is.

Definition at line 1092 of file Objects.cpp.

References getStamina(), TIREDNESS_AVERAGE, TIREDNESS_BAD, TIREDNESS_GOOD, TIREDNESS_TERRIBLE, and TIREDNESS_VERY_BAD.

Referenced by WorldModel::getAgentTiredNess().

double Stamina::getStamina (  )  const

This method returns the current stamina value.

Returns:
current stamina value (>0)

Definition at line 1111 of file Objects.cpp.

References m_dStamina.

Referenced by BasicPlayer::canDribbleFast(), BasicPlayer::canDribbleSlow(), BasicPlayer::canDribbleWithBall(), Player::deMeer5(), getTiredNess(), Player::performPenalty(), and WorldModel::predictStaminaAfterDash().

bool Stamina::setStamina ( double  d  ) 

This method sets the stamina value. This value should be positive, otherwise the value is set to 0 and false is returned.

Parameters:
d new stamina value
Returns:
bool indicating whether value was set.

Definition at line 1120 of file Objects.cpp.

References m_dStamina.

Referenced by AgentObject::AgentObject(), WorldModel::predictStaminaAfterDash(), WorldModel::processNewAgentInfo(), and Stamina().

double Stamina::getEffort (  )  const

This method returns the effort. The effort denotes the percentage of the power in a dash that is actually used. Normally this is 1.0 (100%), but when it comes below a threshold, it decreases. It will again rise when stamina becomes higher than a certain threshold defined in ServerSettings.

Returns:
effort value between 0 and 1

Definition at line 1138 of file Objects.cpp.

References m_dEffort.

Referenced by WorldModel::getAgentEffort(), BasicPlayer::interceptClose(), BasicPlayer::interceptCloseGoalie(), WorldModel::predictStaminaAfterDash(), and WorldModel::predictStateAfterDash().

bool Stamina::setEffort ( double  d  ) 

This method sets the effort value. This value should be between 0 and 1, otherwise the value is set to the closest value in this interval (0 for negative values, 1 for higher values) and false is returned.

Parameters:
d new effort value (0..1)
Returns:
bool indicating whether value was set.

Definition at line 1148 of file Objects.cpp.

References m_dEffort.

Referenced by AgentObject::AgentObject(), WorldModel::predictStaminaAfterDash(), WorldModel::processNewAgentInfo(), and Stamina().

double Stamina::getRecovery (  )  const

This method returns the recovery. Recovery denotes the percentage of the stamina increase that is added to the stamina every cycle. If recovery is 1.0 all of the increase of stamina is added to the current stamina. When stamina becomes below a certain threshold defined in ServerSettings, the recovery is decreased. It can never increase!

Returns:
recovery value between 0 and 1

Definition at line 1171 of file Objects.cpp.

References m_dRecovery.

Referenced by Player::deMeer5(), and WorldModel::predictStaminaAfterDash().

bool Stamina::setRecovery ( double  d  ) 

This method sets the recovery value. This value should be between 0 and 1, otherwise the value is set to the closest value in this interval (0 for negative values, 1 for higher values) and false is returned.

Parameters:
d new recovery value (0..1)
Returns:
bool indicating whether value was set.

Definition at line 1181 of file Objects.cpp.

References m_dRecovery.

Referenced by AgentObject::AgentObject(), WorldModel::predictStaminaAfterDash(), and Stamina().


Field Documentation

double Stamina::m_dStamina [private]

Stamina value (>0)

Definition at line 293 of file Objects.h.

Referenced by getStamina(), setStamina(), and show().

double Stamina::m_dEffort [private]

Effort value (0..1)

Definition at line 294 of file Objects.h.

Referenced by getEffort(), setEffort(), and show().

double Stamina::m_dRecovery [private]

Recovery (0..1)

Definition at line 295 of file Objects.h.

Referenced by getRecovery(), setRecovery(), and show().


The documentation for this class was generated from the following files:
Generated on Thu Apr 26 22:45:32 2007 for GangOfSix(GOS)-RoboCupTeamProject by  doxygen 1.5.1-p1