std::string MentalState::to_string() const { std::string label = ""; switch (get_happiness()) { case HAPPINESS::DEPRESSED: label = "Depressed"; break; case HAPPINESS::SAD: label = "Sad"; break; case HAPPINESS::TROUBLED: label = "Troubled"; break; case HAPPINESS::NEUTRAL: label = "Whatever"; break; case HAPPINESS::CONTENT: label = "Content"; break; case HAPPINESS::HAPPY: label = "Happy!"; break; case HAPPINESS::EUPHORIC: label = "Euphoric"; break; } return (label + " (" + SSTR(m_value) + ")"); }
int SeatingPlan::get_maximum_happiness() const { auto persons = get_persons(); std::sort(persons.begin(), persons.end()); int max_happiness = std::numeric_limits<int>::min() ; do { int happiness = get_happiness(persons); if (happiness > max_happiness) { max_happiness = happiness; } } while (std::next_permutation(persons.begin(), persons.end())); return max_happiness; }