Changeset 8194 for code/branches/dockingsystem/src/modules/pong/PongAI.h
- Timestamp:
- Apr 6, 2011, 12:07:29 PM (13 years ago)
- Location:
- code/branches/dockingsystem
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/dockingsystem
- Property svn:mergeinfo changed
/code/branches/lastmanstanding3 (added) merged: 7903,8155,8165,8170-8175 /code/branches/tetris (added) merged: 8104-8107 /code/trunk (added) merged: 8108,8178-8179,8193
- Property svn:mergeinfo changed
-
code/branches/dockingsystem/src/modules/pong/PongAI.h
r5929 r8194 27 27 */ 28 28 29 /** 30 @file PongAI.h 31 @brief Declaration of the PongAI class. 32 @ingroup Pong 33 */ 34 29 35 #ifndef _PongAI_H__ 30 36 #define _PongAI_H__ … … 33 39 34 40 #include <list> 41 35 42 #include "util/Math.h" 36 43 #include "tools/interfaces/Tickable.h" 44 37 45 #include "controllers/Controller.h" 38 46 39 47 namespace orxonox 40 48 { 49 50 /** 51 @brief 52 The PongAI is an artificial intelligence for the @ref orxonox::Pong "Pong" gametype. 53 54 @author 55 Fabian 'x3n' Landau 56 57 @ingroup Pong 58 */ 41 59 class _PongExport PongAI : public Controller, public Tickable 42 60 { 43 61 public: 44 PongAI(BaseObject* creator); 62 PongAI(BaseObject* creator); //!< Constructor. Registers and initializes the object. 45 63 virtual ~PongAI(); 46 64 47 65 void setConfigValues(); 48 66 49 virtual void tick(float dt); 67 virtual void tick(float dt); //!< Implements the behavior of the PongAI (i.e. its intelligence). 50 68 69 /** 70 @brief Set the ball for the AI. 71 @param ball A pointer to the ball. 72 */ 51 73 void setPongBall(PongBall* ball) 52 74 { this->ball_ = ball; } 53 75 54 76 protected: 55 void calculateRandomOffset(); 56 void calculateBallEndPosition(); 57 void move(char direction, bool bUseDelay); 58 void delayedMove(); 77 void calculateRandomOffset(); //!< Calculates the random offset, that accounts for random errors the AI makes in order to be beatable. 78 void calculateBallEndPosition(); //!< Calculate the end position the ball will be in. 79 void move(char direction, bool bUseDelay); //!< Determine the movement the AI will undertake. 80 void delayedMove(); //!< Is called, when a delayed move takes effect. 59 81 60 PongBall* ball_; 61 Vector2 ballDirection_; 62 float ballEndPosition_; 63 float randomOffset_; 64 bool bChangedRandomOffset_; 65 float relHysteresisOffset_; 66 float strength_; 82 PongBall* ball_; //!< A pointer to the ball. 83 Vector2 ballDirection_; //!< Vector to store the (x,z) direction in which the ball is flying. 84 float ballEndPosition_; //!< The calculated end position of the ball. 85 float randomOffset_; //!< A random offset to introduce random errors (weighted by the strength of the AI) into the AI's behavior. 86 bool bChangedRandomOffset_; //!< Helper boolean, to change the random offset more often. 87 float relHysteresisOffset_; //!< A hysteresis offset. 88 float strength_; //!< The strength of the AI. Ranging from 0 to 1. 67 89 68 std::list<std::pair<Timer*, char> > reactionTimers_; 69 char movement_; 70 char oldMove_; 71 bool bOscillationAvoidanceActive_; 90 std::list<std::pair<Timer*, char> > reactionTimers_; //!< A list of reaction timers and the directions that take effect when their timer expires. 91 char movement_; //!< The planned movement. 92 char oldMove_; //!< The previous movement. 93 bool bOscillationAvoidanceActive_; //!< Boolean, to avoid oscillations. 72 94 }; 73 95 }
Note: See TracChangeset
for help on using the changeset viewer.