diff --git a/CMakeLists.txt b/CMakeLists.txt index 245fb9c..2c3fedb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,4 +12,11 @@ add_executable(deep_miner include/World.h src/BaseRobot.cpp src/SortBot.cpp - src/World.cpp) + src/World.cpp + include/Game.h + include/DigDeepBot.h + include/RandomBot.h + src/DigDeepBot.cpp + src/Game.cpp + src/RandomBot.cpp + main.cpp) diff --git a/include/Game.h b/include/Game.h index e712428..bffbcd4 100644 --- a/include/Game.h +++ b/include/Game.h @@ -21,7 +21,7 @@ class Game { void setup (); void play ( Robot& robot, bool isPlayer ); void checkRearrange ( Robot& robot ); - void applyEffects ( Robot& robot, int effect ); + void applyEffect ( Robot& robot, int effect ); bool isGameOver() const; void printScores() const; void printResult() const; diff --git a/include/World.h b/include/World.h index e8e07d5..cdb2b76 100644 --- a/include/World.h +++ b/include/World.h @@ -14,7 +14,7 @@ class World { int getSurfaceLevel ( int x, int y ) const; int mine ( int x, int y ); - void display () const; + void display ( int p1x = -1, int p1y = -1, int p2x = -1, int p2y = -1 ) const; int getSizeX () const { return _sizeX; } int getSizeY () const { return _sizeY; } diff --git a/src/BaseRobot.cpp b/src/BaseRobot.cpp index cf634cb..1c599f2 100644 --- a/src/BaseRobot.cpp +++ b/src/BaseRobot.cpp @@ -2,6 +2,7 @@ #include "../include/World.h" #include +#include BaseRobot::BaseRobot ( std::string name, int startX, int startY ) : x_ ( startX ), y_ ( startY ), score_ ( 0 ), name_ ( std::move ( name ) ) {} @@ -26,5 +27,51 @@ void BaseRobot::move ( int direction, const World &world ) { } } -// TODO -// int BaseRobot::decideNextMove ( const World &world ) const +int BaseRobot::decideNextMove ( const World &world ) const { + struct Option { + int dir, val; + }; + std::vector