Refactor code style, comments, and robot implementations

Move UML PDF to doc/ and update .gitignore. Normalize includes,
whitespace and function signatures across headers/sources and add
concise class/function documentation. Fix RandomBot so the mine
limit is computed once and simplify DigDeepBot/SortBot mining logic.
Tidy World/Game initialization, error handling, and minor const/var
clarifications for readability and correctness
This commit is contained in:
2026-04-20 12:06:33 +02:00
parent 7dace654d3
commit f45f73cb27
16 changed files with 353 additions and 217 deletions
+14 -11
View File
@@ -4,25 +4,28 @@
#include <string>
/* Base robot implementation shared by all concrete robot types. */
class BaseRobot : public Robot {
/* A robot base class that implements functions common to all robots. */
public:
BaseRobot ( std::string name, int startX, int startY );
BaseRobot(std::string name, int startX, int startY);
void move ( int direction, const World &world ) override;
int decideNextMove ( const World &world ) const override;
void move(int direction, const World& world) override;
int decideNextMove(const World& world) const override;
void setPosition ( int x, int y ) override {
void setPosition(int x, int y) override {
x_ = x;
y_ = y;
}
int getScore () const override { return score_; }
void addScore ( int points ) override { score_ += points; }
int getX () const override { return x_; }
int getY () const override { return y_; }
std::string getName () const override { return name_; }
int getScore() const override { return score_; }
void addScore(int points) override { score_ += points; }
int getX() const override { return x_; }
int getY() const override { return y_; }
std::string getName() const override { return name_; }
protected:
int x_, y_, score_;
int x_;
int y_;
int score_;
std::string name_;
};