Is your feature request related to a problem? Please describe.
Currently, will_drown looks like this:
bool will_drown(agent_type a) { //!OCLINT can't be simpler
switch (a) {
case agent_type::plankton:
return false;
case agent_type::worm:
return false;
case agent_type::bird:
return false;
case agent_type::cow:
return true;
case agent_type::giraffe:
return true;
case agent_type::crocodile:
return false;
case agent_type::chameleon:
return true;
case agent_type::fish:
return false;
case agent_type::whale:
return false;
case agent_type::goat:
return true;
case agent_type::spider:
return true;
case agent_type::octopus:
return false;
case agent_type::snake:
return true;
default:
return true;
}
}
It can be simpler. A messy incomplete code snippet with the main idea here:
#include <set>
bool will_drown(agent_type a) {
//Agents that can drown
const std::set<agent_type> s = { agent_type::cow, agent_type::giraffe };
return s.count(a);
}
Describe the solution you'd like
[ ] First, write the tests
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Currently,
will_drown
looks like this:It can be simpler. A messy incomplete code snippet with the main idea here:
Describe the solution you'd like
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.