Given a float, how to map it to an enum like
{FAIL, POOR, OK, GOOD, EXCELLENT, PERFECT}
if the divisions aren't even.
0.0-0.4 is FAIL
0.4-0.6 is POOR
...
0.8-0.999.. is EXCELLENT
1.0 is PERFECT
The float is a rating value calculated from all the played levels in a game. It ranges from 0..1, both inclusive. There are normally no more than about 10 divisions needed, but the spacings are subject to tuning during development.
I'm currently using a stack of if..else statements. Is that the right way to do it? It seems a bit brittle.