EFHIII / balatro-calculator

A tool for calculating the score of a hand in Balatro
MIT License
65 stars 8 forks source link

Plasma deck calculation bug #42

Closed Svenergy closed 3 months ago

Svenergy commented 3 months ago

It seems sometimes the plasma deck calculation isn't properly truncating the average of chips + mult before squaring it.

I had aces over kings full with plasma deck in game with base values for hand, and it scored 2304 which is 48 48. Calculator is showing 48.5 48.5

This seems to happen with many different variations of hands with the plasma deck, I think in game always just takes the floor value after finding the average of chips + mult.

Incorrect examples with full house - https://efhiii.github.io/balatro-calculator/?h=AACgAKGCMCYLQGgQ https://efhiii.github.io/balatro-calculator/?h=AACgAKGCMCYDgXAQ

Incorrect Example with a 3 of a kind - Shows 31.5 31.5 but should be 31 31 https://efhiii.github.io/balatro-calculator/?h=AADAAMCCECIE

https://github.com/EFHIII/balatro-calculator/blob/716c458072d0f549fe9b667df271153f8a960858/calculator.js#L2737

This line, I believe the floor is being done after it squares the average, but it should be done before squaring the average, it should be Floor((chips + mult)/2)2, but this line is doing Floor((chips + mult)/2)2)

Svenergy commented 3 months ago

image

https://efhiii.github.io/balatro-calculator/?h=AACgALKDUBgLAOAQ

Adding a screenshot example from in game

EFHIII commented 3 months ago

calculator.js is obsolete as of the rewrite which added multithreading and going past 1e300. The relevant lines are: https://github.com/EFHIII/balatro-calculator/blob/716c458072d0f549fe9b667df271153f8a960858/balatro-sim.js#L1736-L1740