jleonard2099 / LHG_ProBB

Lance Haffner Basketball Pro Game
GNU Affero General Public License v3.0
2 stars 0 forks source link

Index Errors during schedule runs #21

Closed jleonard2099 closed 10 months ago

jleonard2099 commented 10 months ago

Approximately every 100-150 games in a schedule, an error will be logged. This seems to happen more often with newer team years.

I suspect this means that something to do with ratings / values along the way is a cause.

At this point, the errors are in the same 3 lines / spots each time.

This would point to the fact tht B1!(D, B) gets an invalid value along the way

B!(D, B) is a reference to the active roster, where D is either 0/1 (the team) and B is the index of the player.

It is also important to note that different teams are involved with each entry in the error log.

My suspicion is that the value of B is somehow reaching an invalid value - going above the number of players in a roster. (i bellieve the fact that these are newer year rosters goes against a consideration for the index referencing a player on an incomplete roster)

jleonard2099 commented 10 months ago

After some initial attempts to trace the root cause of this, I couldn't come up with anything definitive but had a hunch. I updated some variable names for assigning random #'s and (ie, R0 was assigned a value inside a "Case" statement for the previous number generated as R0) it seems to have taken care of the errors being logged.

The issue came to light as one of indexing, as suspected - but from places in the code where B was assigned a value of 6 and then later used as an index for the active roster ball carrier.

It was clear this was the only use for B, so I suspected code somewhere else had a meaning for the 6 value (and to adjust it to 0-4 for an accurate index)

My hunch was somewhat proven by the fact that, right after B=6, some conditionals related to these random #'s seemed to be triggering a use of B as an index.

Several seasons have been simulated without error so I will consider this resolved now.