Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	(revision 12134)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc	(revision 12135)
@@ -5,4 +5,6 @@
 #include <vector>
 #include <string>
+#include <cstdlib>
+#include <ctime>
 
 namespace orxonox
@@ -60,11 +62,12 @@
                     {   
                         if (checkMove(SET_TROOPS_INITIAL)){
-                            this->target_province->owner_ID = this->Player_ID;
+                            this->target_province->setOwner_ID(this->Player_ID);
                             this->target_province->setTroops(this->target_province->getTroops()+1);
-                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl;
+                            orxout()<<"Province "<<this->target_province->getID()<<" owned by Player "<<this->target_province->getOwner_ID()<<" troops: "<<this->target_province->getTroops()<<endl;
                             master->playerFinishedStageCallback(this);
                         }else{
                             orxout()<<"Sorry, someone already owns this provice"<<endl;
                         }
+                        //TODO: Set more troops to provinces before game begins
 
                         break;
@@ -73,9 +76,17 @@
                     case REINFORCEMENT_STAGE:
                     {
-                        if (checkMove(SET_TROOPS)){
-                            this->target_province->setTroops(this->target_province->getTroops()+1);
-                            orxout()<<"Province "<<this->target_province->ID<<" owned by Player "<<this->target_province->owner_ID<<" troops: "<<this->target_province->getTroops()<<endl;
+                        int i = reinforcementCounter(); //i tells how many troops player gets
+                        while (i > 0) 
+                        {
+                            if (checkMove(SET_TROOPS))
+                            {
+                                this->target_province->setTroops(this->target_province->getTroops()+1);
+                                orxout()<<"Province "<<this->target_province->getID()<<" owned by Player "<<this->target_province->getOwner_ID()<<" troops: "<<this->target_province->getTroops()<<endl;
+                                --i;
+                            }
                         }
-                            
+
+                        master->playerFinishedStageCallback(this);    
+                        
                         break;
                     }
@@ -89,4 +100,22 @@
                                 {
                                     //normal fight, 3 attackers, 2 defenders
+                                    int att1 = dice();
+                                    int att2 = dice();
+                                    int att3 = dice();
+                                    int def1 = dice();
+                                    int def2 = dice();
+                                    int attBest = best3(att1, att2, att3);
+                                    int attSecond = second3(att1, att2, att3);
+                                    int defBest = best2(def1, def2);
+                                    int defSecond = second2(def1, def2);
+
+                                    if(defBest >= attBest)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attBest > defBest)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
+                                    if(defSecond >= attSecond)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attSecond > defSecond)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
                                 }
 
@@ -94,4 +123,21 @@
                                 {
                                     //2 attackers, 2 defenders
+                                    int att1 = dice();
+                                    int att2 = dice();
+                                    int def1 = dice();
+                                    int def2 = dice();
+                                    int attBest = best2(att1, att2);
+                                    int attSecond = second2(att1, att2);
+                                    int defBest = best2(def1, def2);
+                                    int defSecond = second2(def1, def2);
+
+                                    if(defBest >= attBest)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attBest > defBest)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
+                                    if(defSecond >= attSecond)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attSecond > defSecond)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
                                 }
 
@@ -99,12 +145,60 @@
                                 {
                                     //1 attacker, 2 defenders
-                                }
-
-                                //TODO: implement other cases
+                                    int attBest = dice();
+                                    int def1 = dice();
+                                    int def2 = dice();
+                                    int defBest = best2(def1, def2);
+
+                                    if(defBest >= attBest)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attBest > defBest)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
+                                }
+
+                                if((this->origin_province->getTroops() >= 4) && (this->target_province->getTroops() == 1))
+                                {
+                                    //3 attackers, 1 defender
+                                    int att1 = dice();
+                                    int att2 = dice();
+                                    int att3 = dice();
+                                    int defBest = dice();
+                                    int attBest = best3(att1, att2, att3);
+
+                                    if(defBest >= attBest)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attBest > defBest)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
+                                }
+
+                                if((this->origin_province->getTroops() == 3) && (this->target_province->getTroops() == 1))
+                                {
+                                    //2 attackers, 1 defender
+                                    int att1 = dice();
+                                    int att2 = dice();
+                                    int defBest = dice();
+                                    int attBest = best2(att1, att2);
+
+                                    if(defBest >= attBest)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attBest > defBest)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
+                                }
+
+                                if((this->origin_province->getTroops() == 2) && (this->target_province->getTroops() == 1))
+                                {
+                                    //1 attacker, 1 defender
+                                    int attBest = dice();
+                                    int defBest = dice();
+
+                                    if(defBest >= attBest)
+                                        this->origin_province->setTroops(this->origin_province->getTroops()-1);
+                                    if (attBest > defBest)
+                                        this->target_province->setTroops(this->target_province->getTroops()-1);
+                                }
                             }
 
                             if (this->target_province->getTroops() == 0) //attacker won
                             {
-                                this->target_province->owner_ID = this->Player_ID;
+                                this->target_province->setOwner_ID(this->Player_ID);
                                 this->target_province->setTroops(this->origin_province->getTroops() - 1);
                                 this->origin_province->setTroops(1);
@@ -120,4 +214,5 @@
                             this->target_province->setTroops(this->origin_province->getTroops()-1);
                             this->origin_province->setTroops(1);
+                            master->playerFinishedStageCallback(this);
                         }
                         break;
@@ -221,3 +316,60 @@
         return false;
     }
+
+    int WagnisPlayer::dice() //returns random integer in range [1, 2, 3, 4, 5, 6] 
+    {
+        srand(time(NULL));
+            return (rand()%6+1);
+    }
+
+    int WagnisPlayer::best3(int a, int b, int c)
+    {
+        if(a >= b && a>= c)
+            return a;
+        if(b >= a && b>= c)
+            return b;
+        else    
+            return c;
+    }
+
+    int WagnisPlayer::best2(int a, int b)
+    {
+        if(a >= b)
+            return a;
+        else 
+            return b; 
+    }
+
+    int WagnisPlayer::second3(int a, int b, int c)
+    {
+        if((a >= b && a <= c)||(a <= b && a >= c))
+            return a;
+        if((b >= a && b <= c)||(b <= a && b >= c))
+            return b;
+        else   
+            return c;
+    }
+
+    int WagnisPlayer::second2(int a, int b)
+    {
+        if(a <= b)
+            return a;
+        else 
+            return b;    
+    }
+
+    int WagnisPlayer::reinforcementCounter() //calculates how many troops a player gets at beginning of his turn
+    {
+        
+        return 10;
+        /*
+        int counter = 0;
+
+        for (int i = 0; i <= 100; ++i)
+        {
+            if
+        }
+        */
+
+    }
 }
Index: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	(revision 12134)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h	(revision 12135)
@@ -49,4 +49,10 @@
         bool isNeighbour(WagnisProvince*, WagnisProvince*);
         bool existPath(WagnisProvince*, WagnisProvince*);
+        int dice();
+        int best3(int, int, int);
+        int best2(int, int);
+        int second3(int, int, int);
+        int second2(int, int);
+        int reinforcementCounter();
     };
 }
