// platypus.h // #ifndef PLATYPUS_H #define PLATYPUS_H #include #include #include /** A platypus */ class Platypus { private: /** The platypus' name */ std::string name; /** * @brief The platypus' gender * * Restricted to 'm' or 'f' * */ std::string gender; /** The platypus' weight */ float weight; /** The platypus' age in months */ short int age; /** The platypus' alive state */ bool alive; /** The platypus' mutant state */ bool mutant; public: /** * @brief A dead platypus * @author Ricky */ Platypus(); // dead platypus /** * @brief A platypus with a custom state * @authors Ricky and Zoltan */ Platypus(float _weight, short _age, std::string _name, std::string _gender) : name(std::move(_name)), gender(std::move(_gender)), weight(_weight), age(_age), alive(true), mutant(false) { srand(static_cast(time(nullptr))); } // constructor that you can pass values to so as to // establish // ~Platypus() {} // Setters, Ricky and Zoltan /** Mutate the platypus' weight */ void setWeight(float _weight) { weight = _weight; } /** Mutate the platypus' age */ void setAge(short _age) { age = _age; } /** Mutate the platypus' name */ void setName(std::string _name) { name = std::move(_name); } /** Mutate the platypus' gender */ void setGender(std::string _gender) { gender = std::move(_gender); } /** Mutate the platypus' alive state */ void setAlive(bool _alive) { this->alive = _alive; } /** Mutate the platypus' mutant state */ void setMutant(bool _mutant) { this->mutant = _mutant; } // Getters, Ricky and Zoltan /** Get the platypus' weight */ float getWeight() const { return weight; } /** Get the platypus' age */ float getAge() const { return age; } /** Get the platypus' name */ std::string getName() { return name; } /** Get the platypus' gender */ std::string getGender() { return gender; } /** Get the platypus' alive state */ bool getAlive() const { return this->alive; } /** Get the platypus' mutant state */ bool getMutant() const { return this->mutant; } // Ricky /** * @brief Print out a platypus */ void print(); /** * @brief Ages the platypus by one * @author Zoltan * * The platypus has a 2% chance of becoming mutant. * * The platypus has a (50% + its weight) chance of death. * */ void ageMe(); /** * @brief Fight another platypus * @author Ricky * * The platypus has a ((platypus / aggressor) * 50) chance of death where the * platypus survives if a random number between one and one-hundred resolves * to greater than the chance of death. * */ void fight(Platypus &); /** * @brief Increases the weight of the platypus by the a random percent between * 0.1 and 5.0 of the current weight. * @author Zoltan * */ void eat(); /** * @brief Birth a new platypus with a random (alive, not mutant) state * @author Zoltan * * If the current platypus is not alive, `hatch`ing will * return an uninitialized platypus. * * @return Platypus */ Platypus hatch() const; }; #endif // PLATYPUS_H