Closed 0xrgb closed 7 years ago
This one will not work :)
int(math.ceil(32 / 10.0)) * 10
is 40
(32 // 10) * 10
is 30
Oh I made a mistake. :cry:
How about (fu + 9) // 10 * 10
? (Score should be (score + 99) // 100 * 100
)
It's ugly, but it works without using floating number.
When you wants to implement some huge score cacluation, such as aotenjou rule, it can cause problems because of floating point errors.
https://github.com/MahjongRepository/mahjong/commit/6ad207ebe45079f0522ed6ae1a023863fa20a439
You're welcome :)
I did minor refactoring of hand calculation and I'm working on the code validation through tenhou replays (it already founded a couple of errors). Once it will be done I will release new version with documentation how to use this package
Thanks for quick fix! :smile:
:+1:
From
mahjong/mahjong/hand_calculating/fu.py
, line 158In addtion, there is no need to import math.
There is a same problem in
mahjong/mahjong/hand_calculating/scores.py
, too.