pish icons im so tired im almost done

This commit is contained in:
2026-10-09 01:40:37 -04:00
parent 9f3bde4fe8
commit ba1a8e5230
8 changed files with 114 additions and 19 deletions
+20
View File
@@ -0,0 +1,20 @@
###############################################
Prompt to Kiro AI (Default):
im getting a list index out of range error very rarely, right as the fishing timer reaches zero and it begins the catching process. any idea what could be causing that? dont fix, explain.
Response:
It's almost certainly the pop() loop in pickRandomCreature.
The loop pops until roll drops to 0 or below. The guard roll = random.random() * (total - 0.0001) is meant to guarantee the roll is always strictly less than total, so the loop empties enough weight before running out of items. But floating-point rounding breaks that guarantee in rare cases.
Here's the problem: total is the sum of all the individual weights. Due to float accumulation error, sum(weights) is not exactly equal to subtracting those same weights one by one. In the unlucky case where roll lands extremely close to total, you can pop every item in possibilities and roll is still above 0 by a tiny epsilon — then the next .pop() hits an empty list → index out of range.
The - 0.0001 fudge shrinks the odds but doesn't eliminate them: if the summed total is itself slightly larger than the re-subtracted total, that 0.0001 margin can be smaller than the accumulated error, especially with your sqrt'd weights which are non-round floats.
Why it's rare and tied to the timer hitting zero: pickRandomCreature only runs at that moment (bite triggers the pick), and it only fails when the random roll lands in that thin top sliver near total. Most rolls land comfortably in the middle, so you almost never see it.
Side note that makes it worse: you pop() from the end of the list every time, which is fine mechanically, but it means the walk order and the weight order are the same list being mutated — so once it's empty there's no fallback. A for-loop over a fixed list with a final default pick would avoid the empty-list crash entirely.
###############################################
+10
View File
@@ -0,0 +1,10 @@
###############################################
Prompt to Kiro AI (Default):
Hard fish should be more difficult AND rarer to catch than easy fish (easy = lower difficulty number). However, im not getting the opportunity to catch a lot of hard fish in the first place, and it really feels like this game isn't very balanced. Can you go ahead and modify any of the numbers you need (but not logic nor code unless absolutely necessary, and you must ask first) to improve the balance, chance, and fairness of the game?
Response:
###############################################