Closed peter1357908 closed 1 year ago
s = "12p78s 45p 7s"
def hand_to_tenhou(hand):
ret = []
suits = {"m": 10, "p": 20, "s": 30, "z": 40}
curr_suit = ""
for c in hand[::-1]:
if c.isalpha():
curr_suit = c
else:
tile = suits[curr_suit] + int(c)
if tile in {10, 20, 30}:
tile = 50 + (tile // 10)
ret.append(tile)
return ret[::-1]
hand, calls, winning_tile, *rest = map(hand_to_tenhou, s.split(" "))
print(hand)
print(calls)
print(winning_tile)
Done in commit b1770d2
Like jekyll-mahjong, allowing sideways tiles.