Index: code/branches/hoverHS15/cmake/CompilerConfigGCC.cmake
===================================================================
--- code/branches/hoverHS15/cmake/CompilerConfigGCC.cmake	(revision 10834)
+++ code/branches/hoverHS15/cmake/CompilerConfigGCC.cmake	(revision 10835)
@@ -72,4 +72,5 @@
 ADD_COMPILER_FLAGS("-fno-omit-frame-pointer" CACHE)
 
+
 # Enable non standard floating point optimisations
 ADD_COMPILER_FLAGS("-ffast-math" CACHE)
Index: code/branches/hoverHS15/src/modules/hover/Hover.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.cc	(revision 10834)
+++ code/branches/hoverHS15/src/modules/hover/Hover.cc	(revision 10835)
@@ -38,4 +38,13 @@
 #include "core/CoreIncludes.h"
 
+#include <iostream>
+#include <string>
+#include <time.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <stdint.h>
+#include <fstream>
+
+
 namespace orxonox
 {
@@ -43,18 +52,48 @@
     int levelcode[10][10] =
         {
-        { 0,0,0,0,0,0,0,0,0,0 }, // row 0
-        { 1,0,0,0,0,0,0,0,0,0 }, // row 0
-        { 1,0,0,0,0,0,0,0,0,0 }, // row 0
-        { 1,1,3,0,1,3,0,0,0,0 }, // row 0
-        { 1,0,3,2,3,2,0,0,0,0 }, // row 0
-        { 1,0,1,0,1,0,0,0,0,0 }, // row 0
-        { 1,2,2,0,0,0,0,0,0,0 }, // row 0
-        { 1,0,0,0,0,0,0,0,0,0 },  // row 0
-        { 1,0,0,0,0,0,0,0,1,0 },// row 1
-        { 1,0,0,0,0,0,0,1,2,0 } // row 2
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }, 
+        { 0,0,0,0,0,0,0,0,0,0 }
         };
 
+    const int NumCells  = 10;
+    unsigned char* g_Maze = new unsigned char[ NumCells* NumCells ];
+
+    // current traversing position
+    int g_PtX;
+    int g_PtY;
+
+    // return the current index in g_Maze
+    int Hover::CellIdx()
+    {
+        return g_PtX + NumCells * g_PtY;
+    }   
+
+
+    int Hover::RandomInt()
+    {
+        return (rand() % NumCells);
+    }
+
+    int Hover::RandomInt4()
+    {
+        return (rand() % 4);
+    }
+
 
     RegisterUnloadableClass(Hover);
+
+
+
+
+
+
 
     Hover::Hover(Context* context) : Gametype(context)
@@ -76,9 +115,15 @@
         if(firstTick)
         {
+            std::fill( g_Maze, g_Maze + NumCells * NumCells, 0 );
+            g_PtX=0;
+            g_PtY=0;
+            GenerateMaze();
+            MazeOut();
+            RenderMaze();
+            LevelOut();
             firstTick = false;
 
             for(int y=0; y<10; y++){
                 for(int x=0; x<10; x++){
-
                     switch(levelcode[y][x]){
                         case 1: new HoverWall(origin_->getContext(), x+1, 10-y, 1);
@@ -96,6 +141,7 @@
 
             
-            //new HoverWall(origin_->getContext(), 1, 1, 1);
-            //new HoverWall(origin_->getContext(), 1, 1, 0);
+            //new HoverWall(origin_->getContext(), 1, 1, 1); //Rechts in Y Richtung
+            //new HoverWall(origin_->getContext(), 5, 6, 0); //Ueber in x richtung
+            //new HoverWall(origin_->getContext(), 5, 5, 0); //Ueber in x richtung
         }      
 
@@ -122,3 +168,165 @@
         GSLevel::startMainMenu();
     }
+
+
+
+
+    ////////////////////////////////////////////////////////////////////////////
+
+
+    //                   0  1  2  3  4  5  6  7  8
+    //                      U  R     D           L
+    int Heading_X[9] = { 0, 0,+1, 0, 0, 0, 0, 0,-1 };
+    int Heading_Y[9] = { 0,-1, 0, 0,+1, 0, 0, 0, 0 };
+    int Mask[9]      = {
+                                0,
+                                eDirection_Down | eDirection_Down << 4,
+                                eDirection_Left | eDirection_Left << 4,
+                                0,
+                                eDirection_Up | eDirection_Up << 4,
+                                0,
+                                0,
+                                0,
+                                eDirection_Right | eDirection_Right << 4
+                            };
+
+
+    ////////////////////////////////////////////////////////////////////////////
+
+    bool Hover::IsDirValid( eDirection Dir )
+    {
+        int NewX = g_PtX + Heading_X[ Dir ];
+        int NewY = g_PtY + Heading_Y[ Dir ];
+
+        if ( !Dir || NewX < 0 || NewY < 0 || NewX >= NumCells || NewY >= NumCells ) return false;
+
+        return !g_Maze[ NewX + NumCells * NewY ];
+    }
+
+    eDirection Hover::GetDirection()
+    {
+        eDirection Dir = eDirection( 1 << RandomInt4() );
+
+        while ( true )
+        {
+            for ( int x = 0; x < 4; x++ )
+            {
+                if ( IsDirValid( Dir ) ) { return eDirection( Dir ); }
+
+                Dir = eDirection( Dir << 1 );
+
+                if ( Dir > eDirection_Left ) { Dir = eDirection_Up; }
+            }
+
+            Dir = eDirection( ( g_Maze[ CellIdx() ] & 0xf0 ) >> 4 );
+
+            // nowhere to go
+            if ( !Dir ) return eDirection_Invalid;
+
+            g_PtX += Heading_X[ Dir ];
+            g_PtY += Heading_Y[ Dir ];
+
+            Dir = eDirection( 1 << RandomInt4() );
+        }
+    }
+
+    void Hover::GenerateMaze()
+    {
+        int Cells = 0;
+
+        for ( eDirection Dir = GetDirection(); Dir != eDirection_Invalid; Dir = GetDirection() )
+        {
+            // a progress indicator, kind of
+           // if ( ++Cells % 1000 == 0 ) std::cout << ".";
+
+            g_Maze[ CellIdx() ] |= Dir;
+
+            g_PtX += Heading_X[ Dir ];
+            g_PtY += Heading_Y[ Dir ];
+
+            g_Maze[ CellIdx() ] = Mask[ Dir ];
+        }
+
+        std::cout << std::endl;
+    }  
+    
+
+    void Hover::MazeOut(){
+        for ( int y = 0; y < NumCells; y++ )
+        {
+            for ( int x = 0; x < NumCells; x++ )
+            {
+                char v = g_Maze[ y * NumCells + x ];
+                orxout()<<"[";
+                if ( ( v & eDirection_Up    ) ) orxout()<<"U";
+                else orxout()<<" ";
+                if ( ( v & eDirection_Right ) ) orxout()<<"R";
+                else orxout()<<" ";
+                if ( ( v & eDirection_Down  ) ) orxout()<<" ";
+                else orxout()<<" ";
+                if ( ( v & eDirection_Left  ) ) orxout()<<" ";
+                else orxout()<<" ";
+                orxout()<<"]";
+            }
+            orxout()<<endl;
+        }
+
+    }
+
+    void Hover::LevelOut(){
+        for ( int y = 0; y < NumCells; y++ )
+        {
+            for ( int x = 0; x < NumCells; x++ )
+            {
+                /*orxout()<<"[";
+                if ( levelcode[x][y] < 2) orxout()<<"U";
+                else orxout()<<" ";
+                if ( levelcode[x][y] % 2 == 0) orxout()<<"R";
+                else orxout()<<" ";
+
+                orxout()<<" ";
+                orxout()<<" ";
+                orxout()<<"]";*/
+
+                orxout()<<levelcode[x][y];
+            }
+            orxout()<<endl;
+        }
+
+
+
+    }
+
+    void Hover::RenderMaze()
+    {
+        for ( int y = 0; y < NumCells; y++ )
+        {
+            for ( int x = 0; x < NumCells; x++ )
+            {
+                char v = g_Maze[ y * NumCells + x ];
+
+                if ( !( v & eDirection_Up    ) && y >0) levelcode[y][x] |= 2;
+                if ( !( v & eDirection_Right ) && x <9) levelcode[y][x] |= 1;
+                //if ( !( v & eDirection_Down  ) && y>0) levelcode[x][y-1] += 2;
+                //if ( !( v & eDirection_Left  ) && x>0) levelcode[x-1][y] += 1;
+            }
+        }
+        for ( int y = 3; y < 7; y++ )
+        {
+            for ( int x = 3; x < 7; x++ )
+            {
+
+                if(y == 3 && x != 7)
+                    levelcode[y][x] &= 2;
+                else if (x == 7 && y != 3)
+                    levelcode[y][x] &= 1;
+                else if(x != 7)
+                    levelcode[y][x] = 0;
+            }
+        }
+
+    }
+
+
+
 }
Index: code/branches/hoverHS15/src/modules/hover/Hover.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.h	(revision 10834)
+++ code/branches/hoverHS15/src/modules/hover/Hover.h	(revision 10835)
@@ -58,6 +58,17 @@
 #include "tools/Timer.h"
 
+
+
 namespace orxonox
 {
+
+    enum eDirection
+    {
+        eDirection_Invalid = 0,
+        eDirection_Up      = 1,
+        eDirection_Right   = 2,
+        eDirection_Down    = 4,
+        eDirection_Left    = 8
+    }; 
 
     class _HoverExport Hover : public Gametype
@@ -80,4 +91,18 @@
             WeakPtr<HoverOrigin> origin_;
 
+        private:
+            int CellIdx();
+            int RandomInt();
+            int RandomInt4();
+
+
+            bool IsDirValid( eDirection Dir );
+            eDirection GetDirection();
+            void GenerateMaze();
+            void RenderMaze();
+            void MazeOut();
+            void LevelOut();
+
+
     };
 }
