14 std::shared_ptr<FieldParams> fieldParams_;
15 std::shared_ptr<CreepersParams> CreepersParams_;
16 std::shared_ptr<StevesParams> StevesParams_;
30 fieldParams_ = std::make_shared<FieldParams>(bounds, distanceFunc);
39 if (!fieldParams_)
throw std::invalid_argument(
"FieldParams_ is not set");
52 throw std::invalid_argument(
"fieldParams_ is not set");
54 CreepersParams_ = std::make_shared<CreepersParams>(moveRadius, explodeRadius, fieldParams_, count);
58 if (!CreepersParams_)
throw std::invalid_argument(
"CreepersParams_ is not set");
59 return CreepersParams_;
70 throw std::invalid_argument(
"fieldParams_ is not set");
72 StevesParams_ = std::make_shared<StevesParams>(moveRadius, fieldParams_, count);
77 if (!StevesParams_)
throw std::invalid_argument(
"StevesParams_ is not set");
82 const auto upBound = fieldParams_->getBounds().rightUpBound;
83 const auto downBound = fieldParams_->getBounds().leftDownBound;
84 if (bedrock.rightUpBound.x > upBound.x || bedrock.rightUpBound.y > upBound.y ||
85 bedrock.leftDownBound.x < downBound.x || bedrock.leftDownBound.y < downBound.y) {
86 LOG(WARNING) <<
"Bedrock is out of field bounds!";
95 return Simulation(fieldParams_, CreepersParams_, StevesParams_);
A factory class for configuring and creating Simulation objects.
Definition SimulationFabric.hpp:13
SimulationFabric()=default
Default constructor for SimulationFabric.
decltype(fieldParams_) getFieldParams()
Retrieves the field parameters.
Definition SimulationFabric.hpp:38
SimulationFabric & setBedrock(const Rectangle &bedrock)
Definition SimulationFabric.hpp:81
SimulationFabric & setCreeperParams(double moveRadius=10, double explodeRadius=10, uint32_t count=0)
Sets the parameters for creepers in the simulation.
Definition SimulationFabric.hpp:50
SimulationFabric & setSteveParams(double moveRadius=10, uint32_t count=0)
Sets the parameters for Steves in the simulation.
Definition SimulationFabric.hpp:68
Simulation build()
Definition SimulationFabric.hpp:92
decltype(CreepersParams_) getCreepersParams_()
Definition SimulationFabric.hpp:57
SimulationFabric & setFieldParams(const Rectangle &bounds, const std::function< double(Point p1, Point p2)> &distanceFunc)
Sets the field parameters for the simulation.
Definition SimulationFabric.hpp:29
decltype(StevesParams_) getStevesParams_()
Definition SimulationFabric.hpp:76
Main controller for managing the simulation of creepers and Steves.
Definition Simulation.hpp:16
Represents a 2D point with x and y coordinates.
Definition utils.hpp:10
Represents a rectangle defined by two points: bottom-left and top-right.
Definition utils.hpp:24