Index: code/branches/pCuts/data/levels/tetris.oxw
===================================================================
--- code/branches/pCuts/data/levels/tetris.oxw	(revision 9086)
+++ code/branches/pCuts/data/levels/tetris.oxw	(revision 9087)
@@ -27,7 +27,4 @@
       <Model position="0,0,0" mesh="crate.mesh" scale=1 />
     </attached>
-    <!--collisionShapes>
-      <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
-    </collisionShapes-->
   </TetrisStone>
 </Template>
@@ -39,6 +36,6 @@
     <camerapositions>
       <CameraPosition position="55,75,200" absolute=true />
-      <CameraPosition position="0,50,160" drag=true mouselook=true />
-      <CameraPosition position="0,50,0" pitch=-90 drag=true mouselook=true />
+      <!--CameraPosition position="0,50,160" drag=true mouselook=true /-->
+      <!--CameraPosition position="0,50,0" pitch=-90 drag=true mouselook=true /-->
     </camerapositions>
   </TetrisBrick>
Index: code/branches/pCuts/src/modules/tetris/Tetris.cc
===================================================================
--- code/branches/pCuts/src/modules/tetris/Tetris.cc	(revision 9086)
+++ code/branches/pCuts/src/modules/tetris/Tetris.cc	(revision 9087)
@@ -23,6 +23,16 @@
  *      ...
  *   Co-authors:
- *      ...
- *
+ *      Johannes Ritz
+ *
+ *BUG a) double stone model (@ brick's location the stone's model is duplicated. Why does the brick have a model attached to it.)
+ *BUG b) the brick is set the wrong way after a (brick-brick) collision, if the brick was turned
+ *BUG c) destroying the old stones causes segfault -> WeakPointer as solution ?
+ *BUG
+ *
+ *TASK a) give points for winning
+ *TASK b) write a hud (show points gained; new brick)
+ *TASK c) end the game in a nicer way
+ *TASK d) save the highscore
+ *TASK e) eye candy
  */
 
@@ -65,4 +75,5 @@
 
         this->player_ = NULL;
+        this->endGameCriteria_ = 0.0f;
     }
 
@@ -94,6 +105,7 @@
         SUPER(Tetris, tick, dt);
 
-        if(this->activeBrick_ != NULL)
-        {
+        if((this->activeBrick_ != NULL)&&(!this->hasEnded()))
+        {
+        	this->endGameCriteria_ += dt;
             if(!this->isValidBrickPosition(this->activeBrick_, this->activeBrick_->getPosition()))
             {
@@ -101,6 +113,10 @@
                 this->activeBrick_->releaseStones(this->center_);
                 //delete this->activeBrick_; //releasing the memory
+                this->findFullRows();
+                if(this->endGameCriteria_ < 0.1f) //end game if two bricks are created within a 0.1s interval.
+                    this->end();
                 this->createBrick();
                 this->startBrick();
+                this->endGameCriteria_ = 0.0f;
             }
         }
@@ -257,4 +273,5 @@
     void Tetris::end()
     {
+        this->activeBrick_->setVelocity(Vector3::ZERO);
         this->cleanup();
 
@@ -366,16 +383,19 @@
     @brief Manage score.
     */
-    void Tetris::clearFullRow()
-    {
+    void Tetris::findFullRows()
+    {
+    	unsigned int correctPosition = 0;
+		orxout()<< "clear full rows ************ " <<endl;
     	unsigned int stonesPerRow = 0;
-    	for (unsigned int row = 0; row < this->center_->getHeight()/this->center_->getStoneSize(); row++)
+    	for (unsigned int row = 0; row < this->center_->getHeight(); row++)
     	{
     	    stonesPerRow = 0;
             for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it)
             {
-                if((*it)->getPosition().y == row)
+            	correctPosition = static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize());
+                if(correctPosition == row)
                 	stonesPerRow++;
-                if(stonesPerRow == this->center_->getWidth()/this->center_->getStoneSize())
-                    orxout()<< "CANDIDATE FOUND in row " << row <<endl;
+                if(stonesPerRow == this->center_->getWidth())
+                    {orxout()<< "CANDIDATE FOUND in row " << row <<endl; clearRow(row);}
             }
 
@@ -383,3 +403,20 @@
     }
 
+    void Tetris::clearRow(unsigned int row)
+    {//std::vector<int>::iterator it = v.begin()
+        for(std::vector<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        {
+            if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row)
+            	(*it)->setPosition(Vector3(-10,-10,0));
+            	//{(*it)->destroy(); this->stones_.erase(it); orxout()<< "destroy row "<<endl;}//experimental
+        }
+        for(std::vector<TetrisStone*>::const_reverse_iterator it2 = this->stones_.rbegin(); it2 != this->stones_.rend(); ++it2)
+        {
+            /*if(static_cast<unsigned int>(((*it2)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
+                (*it2)->setPosition((*it2)->getPosition()-Vector3(0,1,0));//*/
+        }
+
+    }
+
+
 }
Index: code/branches/pCuts/src/modules/tetris/Tetris.h
===================================================================
--- code/branches/pCuts/src/modules/tetris/Tetris.h	(revision 9086)
+++ code/branches/pCuts/src/modules/tetris/Tetris.h	(revision 9087)
@@ -85,5 +85,6 @@
             bool isValidStonePosition(TetrisStone* stone, const Vector3& position);
             bool isValidBrickPosition(TetrisBrick* brick, const Vector3& position);
-            void clearFullRow(void);
+            void findFullRows(void);
+            void clearRow(unsigned int row);
 
             
@@ -97,4 +98,5 @@
             
             Timer starttimer_; //!< A timer to delay the start of the game.
+            float endGameCriteria_; //<! Works as a timer which is resetted, whenever a brick is created.
     };
 }
Index: code/branches/pCuts/src/modules/tetris/TetrisBrick.cc
===================================================================
--- code/branches/pCuts/src/modules/tetris/TetrisBrick.cc	(revision 9086)
+++ code/branches/pCuts/src/modules/tetris/TetrisBrick.cc	(revision 9087)
@@ -40,4 +40,5 @@
 #include "TetrisStone.h"
 #include "Tetris.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -52,6 +53,5 @@
     {
         RegisterObject(TetrisBrick);
-
-        this->shapeIndex_ = 4; //<! TODO: random number between 0 and 7
+        this->shapeIndex_ = static_cast<unsigned int>(rnd(7.0f)); //<! random number between 0 and 7
         this->stonesPerBrick_ = 4; //<! most tetris bricks is formed by 4 stones
         this->delay_ = false;
@@ -105,6 +105,4 @@
     void TetrisBrick::formBrick(TetrisStone* stone, unsigned int i)
     {
-    	if(i != 0 && this->shapeIndex_ == 0)
-    	    orxout() << "So it has come to this in TetrisBrick.cc"<< endl;
         if(i == 0) //setting the first stone as
         {
