Index: code/branches/tetris/src/modules/pong/PongAI.cc
===================================================================
--- code/branches/tetris/src/modules/pong/PongAI.cc	(revision 8099)
+++ code/branches/tetris/src/modules/pong/PongAI.cc	(revision 8107)
@@ -27,4 +27,9 @@
  */
 
+/**
+    @file PongAI.cc
+    @brief Implementation of the PongAI class.
+*/
+
 #include "PongAI.h"
 
@@ -32,5 +37,7 @@
 #include "core/ConfigValueIncludes.h"
 #include "tools/Timer.h"
+
 #include "worldentities/ControllableEntity.h"
+
 #include "PongBall.h"
 
@@ -41,4 +48,8 @@
     const static float MAX_REACTION_TIME = 0.4f;
 
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
     PongAI::PongAI(BaseObject* creator) : Controller(creator)
     {
@@ -59,4 +70,8 @@
     }
 
+    /**
+    @brief
+        Destructor. Cleans up the list fo reaction timers.
+    */
     PongAI::~PongAI()
     {
@@ -65,12 +80,25 @@
     }
 
+    /**
+    @brief
+        Sets config values.
+    */
     void PongAI::setConfigValues()
     {
+        // Sets the strength of the PongAi as a config value.
         SetConfigValue(strength_, 0.5).description("A value from 0 to 1 where 0 is weak and 1 is strong.");
     }
 
+    /**
+    @brief
+        Is called each tick.
+        Implements the behavior of the PongAI (i.e. its intelligence).
+    @param dt
+        The time that has elapsed since the last tick.
+    */
     void PongAI::tick(float dt)
     {
-        if (!this->ball_ || !this->getControllableEntity())
+        // If either the ball, or the controllable entity (i.e. the bat) don't exist (or aren't set).
+        if (this->ball_  == NULL || this->getControllableEntity() == NULL)
             return;
 
@@ -109,5 +137,5 @@
             if (this->ballDirection_.x != 1)
             {
-                // The ball just startet to approach, initialize all values
+                // The ball just started to approach, initialize all values
                 this->ballDirection_.x = 1;
                 this->ballDirection_.y = sgn(ballvel.z);
@@ -158,5 +186,5 @@
             {
                 // We had to correct our position because we moved too far
-                // (and delay ist false, so we're not in the wrong place because of a new end-position prediction)
+                // (and delay is false, so we're not in the wrong place because of a new end-position prediction)
                 if (fabs(mypos.z - this->ballEndPosition_) < 0.5 * this->ball_->getBatLength() * this->ball_->getFieldDimension().y)
                 {
@@ -173,4 +201,10 @@
     }
 
+    /**
+    @brief
+        Calculates the random offset, that accounts for random errors the AI makes in order to be beatable.
+        The higher the strength of the AI, the smaller the (expected value of the) error.
+        The result of this method is stored in this->randomOffset_.
+    */
     void PongAI::calculateRandomOffset()
     {
@@ -184,5 +218,5 @@
                                           // exp < 1 -> position is more likely a large number
 
-        // The position shouln't be larger than 0.5 (50% of the bat-length from the middle is the end)
+        // The position shouldn't be larger than 0.5 (50% of the bat-length from the middle is the end)
         position *= 0.48f;
 
@@ -194,4 +228,9 @@
     }
 
+    /**
+    @brief
+        Calculate the end position the ball will be in.
+        The result of this calculation is stored in this->ballEndPosition_.
+    */
     void PongAI::calculateBallEndPosition()
     {
@@ -295,4 +334,13 @@
     }
 
+    /**
+    @brief
+        Determine the movement the AI will undertake. (Either -1, 0 or 1)
+        The result of this calculation is stored in this->movement_;
+    @param direction
+        The current direction of movement.
+    @param bUseDelay
+        The time by which this move is delayed. (Again, to make the AI less efficient)
+    */
     void PongAI::move(char direction, bool bUseDelay)
     {
@@ -321,4 +369,8 @@
     }
 
+    /**
+    @brief
+        Is called, when a delayed move takes effect.
+    */
     void PongAI::delayedMove()
     {
