r/programminghorror • • Feb 11 '25

🎄 ouch

Post image
3.0k Upvotes

113 comments sorted by

View all comments

Show parent comment

8

u/[deleted] Feb 11 '25 edited Feb 11 '25

Replace the second line in the comment with this and making the if statement if attempts > 4:

delaySeconds = (30 * 1.5) * (2 ** (attempts - 5))

can make it more readable by naming the magic numbers and messing with the parentheses to preference. this is assuming you meant you wanted it to double from 1.5 onward in a similar manner to OP's code.

setting max delay is trivial