Bot.action_kakan() uses wrong pai
Closed this issue · 3 comments
shinkuan commented
Describe the bug
mjai.app/python/mjai/bot/base.py
Lines 429 to 438 in b53fa40
Here at line 434, pai should be the tile that add to the pon meld but not last_kawa_tile
Additional context
A fix:
def action_kakan(self, consumed: list[str]) -> str:
if consumed[0][0] == '5' and consumed[0][1] != 'z':
if any(red in consumed for red in ['5mr', '5pr', '5sr']):
pai = consumed[0][:2]
else:
pai = consumed[0]+'r'
else:
pai = consumed[0]
return json.dumps(
{
"type": "kakan",
"actor": self.player_id,
"pai": pai,
"consumed": consumed, # 3 tiles to be consumed
},
separators=(",", ":"),
)
smly commented
Thanks for the report. To make it more simple, I will remove the argument for action_kakan()
. Kakan always uses self.last_self_tsumo
, so no argument is needed.
shinkuan commented
I thought you can can call Kakan from a non tsumo tile in tehei. Sorry I didn't know much details about rules.
smly commented
Oh.. I was wrong. Thanks for pointing this out to me.