Because my original version of the algorithm was wrong, that's why! :) I've fixed it. I don't know if it is any clearer. The basic idea is that the tests for points and quota are not independent; they follow the form:
$points > 2000*X && $quota < 15+X
for some integer 0 < X < 10. One can eliminate the redundancy between these two tests. Algebraically, the above is equivalent to
$points/2000 > X && X > $quota-15
...which can be further reduced to
$points/2000 + 15 > $quota
...except that there are edge cases (basically, X must be an integer strictly between 0 and 10) which make the algorithm a bit more complex.
|