Python 3.12 no longer supports using non-integer values as arguments for
random functions (see [Changes in the Python API for 3.12][0]). This PR
casts `CONST_RARITY_MAX` to an integer to prevent a `TypeError` from
being raised.
[0]: https://docs.python.org/3/whatsnew/3.12.html#changes-in-the-python-api
I noticed that on tilde.town users with a high botany score used up a
lot of CPU cycles. I skimmed through the code and didn't immediately see
any tight loops, but after profiling against a user's borrowed .botany
directory I saw the culprit: the score increase thread.
This thread was designed to increase the user's score by 1 every time
the thread did an iteration of its infinite loop. It would sleep for an
interval scaled *down* based on how high a user's generation bonus was.
This meant that the sleep interval trended towards zero, creating a
tight loop for high scoring users.
This commit changes the code to use a constant sleep inteveral but scale
the score increment *up* based on generation.
I also removed the death check thread entirely since we were already
checking for death in the score thread. I also short circuited the death
check.
This had the effect of reducing CPU load for a high scoring user by a
factor of about 50.