Fix divide by 0 issues during betting calculations #589
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR aims to avoid inadvertent divide by 0 errors by clamping the minimum divide values to 1 while betting as a defensive measure
Why
Currently bet.py can trigger divide by 0 errors under certain scenarios. In theory given we are calculating percentages / decimal probabilities in this part of the code all dividing values should be > 0 in either case.
This should hopefully raise the stability of the script in edge cases
How
By clamping any values we use for calculating the values to divide to by to one and above
Type of change
Please delete options that are not relevant.
Checklist: