LilasCorner / jlootbox

Other
1 stars 0 forks source link

Consider calculating averages using floats or doubles instead of ints #9

Open JohnTMurphy-NIU opened 2 years ago

JohnTMurphy-NIU commented 2 years ago

By using integer division and returning integer values in Player.avgHistPrice() and Player.avgHistValue() you may be missing some variation; a player with recent scores of 4, 4, 4, 4, 4 would not perceive that a player with recent scores of 4, 5, 5, 5, 5 is 'doing better', because the average of both when truncated is 4. Consider returning the full values un-truncated and comparing these. (You may need a separate method is you are using the value to drive color and need an int for the display.)

JohnTMurphy-NIU commented 2 years ago

A similar issue may occur in 'updateThreshold' under the 'PRICE' case, where the oldVal and newVal variables are ints calculated as ratios other ints.