f45f73cb27
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
31 lines
699 B
C++
31 lines
699 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include "Robot.h"
|
|
#include "World.h"
|
|
|
|
/* Coordinates game setup, turn order, world updates, and final scoring output. */
|
|
class Game {
|
|
public:
|
|
Game ();
|
|
void run ();
|
|
|
|
private:
|
|
World world_;
|
|
std::unique_ptr<Robot> player_;
|
|
std::unique_ptr<Robot> computer_;
|
|
bool autoMode_ = false;
|
|
int lastThreshold_ = 0;
|
|
|
|
void setup ();
|
|
void play ( Robot &robot, bool isPlayer );
|
|
void checkRearrange ( Robot &robot );
|
|
void applyEffect ( Robot &robot, int effect );
|
|
bool isGameOver () const;
|
|
void printScores () const;
|
|
void printResult () const;
|
|
|
|
std::unique_ptr<Robot> createRobot ( int choice, int x, int y ) const;
|
|
};
|