int BunnySociety::StartBunnySociety() { /// Starting the society printing. BunnySocietyPrint(); //do { { ///If a bunny becomes older than 10 years old, it dies. ///Radioactive vampire bunnies do not die until they reach age 50. /// First step increase everybody's age. cout << "------------------------------------------------------" << endl; Bunny bunny = bunnyDatastructure.GetBunnyONIndex(0); do { int bunnyAge = bunny.GetAge(); if (bunny.GetBunnyMutant()) { if (bunnyAge >= 50) { cout << "Mutant Bunny Killed :::" + bunny.GetBunnyName() << endl; bunnyDatastructure.DeleteBunny(bunny); } } else { if (bunnyAge >= 10) { cout << "Bunny Killed :::" + bunny.GetBunnyName() << endl; bunnyDatastructure.DeleteBunny(bunny); } } } while ( (bunnyDatastructure.GetNextBunny() != null)); { } cout << "------------------------------------------------------" << endl; } { ///Each turn afterwards the bunnies age 1 year. for (int i = 0; i < bunnyDatastructure.GetCount(); i++) { Bunny bunny = bunnyDatastructure.GetBunnyONIndex(i); bunny.PrintBunnyObject(); } } //thread(100); } //while (bunnyDatastructure.GetCount() > 0); return 0; }
bool FemaleBunny::CanBreedWith(const Bunny& other) const { return this->age >= 2 && other.GetGender() == BunnyGender::Male && other.GetAge() >= 2; }