diff options
| author | Fuwn <[email protected]> | 2022-05-25 18:18:54 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-05-25 18:18:54 -0700 |
| commit | eef537e8c822e67f3407d5ac44ddfd6e6d4aac37 (patch) | |
| tree | 77fab591bd5a67b1395a92a7b658232916f5f8a5 | |
| parent | format(platypus): grammar (diff) | |
| download | wk7_platypusproject-eef537e8c822e67f3407d5ac44ddfd6e6d4aac37.tar.xz wk7_platypusproject-eef537e8c822e67f3407d5ac44ddfd6e6d4aac37.zip | |
docs(platypus): add authors
| -rw-r--r-- | platypus/platypus.cpp | 7 | ||||
| -rw-r--r-- | platypus/platypus.h | 22 | ||||
| -rw-r--r-- | platypus/testPlatypus.cpp | 1 |
3 files changed, 26 insertions, 4 deletions
diff --git a/platypus/platypus.cpp b/platypus/platypus.cpp index 0c8f834..094fae5 100644 --- a/platypus/platypus.cpp +++ b/platypus/platypus.cpp @@ -6,6 +6,7 @@ #include <iostream> #include <string> +// Ricky Platypus::Platypus() { // Initialise the platypus with default state weight = 0.; @@ -15,10 +16,12 @@ Platypus::Platypus() { name = " "; gender = " "; + // Zoltan srand(static_cast<unsigned int>(time(nullptr))); rand(); } +// Ricky void Platypus::print() { // Print out the platypus' state std::cout << "THE PLATYPUS.......\n"; @@ -33,6 +36,7 @@ void Platypus::print() { << "." << std::endl; } +// Zoltan void Platypus::ageMe() { // Only increment a platypus' age if it is alive if (this->alive) { @@ -51,6 +55,7 @@ void Platypus::ageMe() { } } +// Ricky void Platypus::fight(Platypus &p1) { // Only let two platypi fight if they are both alive if (this->alive && p1.alive) { @@ -70,6 +75,7 @@ void Platypus::fight(Platypus &p1) { } } +// Zoltan void Platypus::eat() { // Only increment the platypus' weight if the platypus is alive if (this->alive) { @@ -80,6 +86,7 @@ void Platypus::eat() { } } +// Zoltan Platypus Platypus::hatch() const { // Only birth a new platypus if the birthing platypus is alive if (this->alive) { diff --git a/platypus/platypus.h b/platypus/platypus.h index 3e9ce2b..05cca77 100644 --- a/platypus/platypus.h +++ b/platypus/platypus.h @@ -29,9 +29,15 @@ private: std::string gender; public: - /** A dead platypus */ + /** + * @brief A dead platypus + * @author Ricky + */ Platypus(); // dead platypus - /** A platypus with a custom state */ + /** + * @brief A platypus with a custom state + * @authors Ricky and Zoltan + */ Platypus(float _weight, short _age, std::string _name, std::string _gender) : weight(_weight), age(_age), alive(true), mutant(false), name(std::move(_name)), gender(std::move(_gender)) { @@ -41,7 +47,7 @@ public: // establish // ~Platypus() {} - // Setters + // Setters, Ricky and Zoltan /** Mutate the platypus' weight */ void setWeight(float _weight) { weight = _weight; } /** Mutate the platypus' age */ @@ -55,7 +61,7 @@ public: /** Mutate the platypus' mutant state */ void setMutant(bool _mutant) { this->mutant = _mutant; } - // Getters + // Getters, Ricky and Zoltan /** Get the platypus' weight */ float getWeight() const { return weight; } /** Get the platypus' age */ @@ -69,9 +75,14 @@ public: /** 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. * @@ -81,6 +92,7 @@ public: 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 @@ -91,11 +103,13 @@ public: /** * @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. diff --git a/platypus/testPlatypus.cpp b/platypus/testPlatypus.cpp index f5bed83..0a634e7 100644 --- a/platypus/testPlatypus.cpp +++ b/platypus/testPlatypus.cpp @@ -5,6 +5,7 @@ #include <iostream> using namespace std; +// The testing suite is pretty much 50-50 between us. (Ricky and Zoltan) int main() { // Test `Platypus` constructors, setters, getters, `eat`ing, aging, and // `print`ing |