dnovikoff/tempai-core

Issue with Riichi Mahjong Points Calculation

Closed this issue · 3 comments

I am using this package for calculating Riichi mahjong points. I've noticed an inconsistency when handling special hands, particularly with YakumanTenhou and YakumanKokushi13.

Problem Description:

When setting ctx.IsFirstTake = true and providing a Kokushi13 tile set, both YakumanTenhou and YakumanKokushi13 should be valid simultaneously. However, only YakumanKokushi13 gets registered.

The root cause appears to be in the func (c *calculator) run() *Result method. If c.tryKokushi() returns true, the function immediately proceeds to c.calculateResult(), bypassing the c.tryTsumo() method where YakumanTenhou is determined and added.

Expected Behavior:

Both YakumanTenhou and YakumanKokushi13 should be recognized and calculated correctly when the conditions are met.

Suggested Solution:

Adjust the function's control flow to ensure that c.tryTsumo() is called even when c.tryKokushi() returns true.

Thanks for the issue. I look into it and will return with the answer

Please check the fix

Thanks for the fix. It works now.