dnovikoff / tempai-core

Riichi mahjong golang library
MIT License
23 stars 4 forks source link

Issue with Riichi Mahjong Points Calculation #9

Closed hphphp123321 closed 11 months ago

hphphp123321 commented 11 months ago

I am using this package for calculating Riichi mahjong points. I've noticed an inconsistency when handling special hands, particularly with YakumanTenhouand 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.

dnovikoff commented 11 months ago

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

dnovikoff commented 11 months ago

Please check the fix

hphphp123321 commented 11 months ago

Thanks for the fix. It works now.