MahjongRepository / mahjong

Implementation of riichi mahjong related stuff (hand cost, shanten, agari end, etc.)
MIT License
377 stars 38 forks source link

Optional rules: Renhou as yakuman, Daisharin, Daisuurin, Daichikurin; Yaku_id now supplied externally #10

Closed Enerccio closed 5 years ago

Enerccio commented 5 years ago

So I moved yaku_id from internal constant into externally supplied constant (in yaku_config) because adding new yaku was rather terrible :)

If you merge this, I would want to work on refactoring optional rules and hand state (ie move stuff that are optional rule variants into separate class and have it as a parameter in hand_config so it cna be reused and it is cleaner)

Nihisil commented 5 years ago

Your changes look good :) I have one thing that concerns me. yaku_id was mapped to yaku ids from tenhou.net, so when we did hands validation we were able to match that our calculated yaku are identical to yaku from tenhou.

Maybe we can store them in the separate variable otherwise, we will be not able to do hands validation in the future.

Enerccio commented 5 years ago

if you can list them to me in order I could add them as constants in the yaku config, the point was that editing them across files was cumbersome.

Nihisil commented 5 years ago

What is point of editing them btw? For new yaku we can assign 100+ ids to avoid duplication with old ones.

Enerccio commented 5 years ago

well it is used in sorting the yaku, no?

Nihisil commented 5 years ago

It wasn't designed for that purpose, I have added them only to validation needs.

Enerccio commented 5 years ago

Ah okay, well maybe keep them for the ordering and just add tenhou_id with the old value?

Nihisil commented 5 years ago

Yep, this one looks good to me :)

Enerccio commented 5 years ago

added tenhou_id back, also refactored optional rules to separate class

Nihisil commented 5 years ago

Thank you for doing this!

Enerccio commented 5 years ago

haha I only started, now I will add all optional rules I know :)

Nihisil commented 5 years ago

@Enerccio I have sent you an invitation to project collaboration. I think it will be a bit easier to work without forks. But it is up to you how to process further.