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:
+14
-11
@@ -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_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user