1

I am reading some introduction of an ancient Chinese game called Mahjong (a bit like poker but far more complicated). I have been spending couple days in writing a program to determine if a given hand is a win hand or not. Do anyone have any idea or know where can I find the free code for that? I only need the part to determine win/lose, I am not looking for the entire project. Thanks.

user1285419
  • 2,183
  • 7
  • 48
  • 70
  • The winner is determined (even in perfect play) by the discards of all players, and frequently there is no perfect choice for a discard. This leads to a lack of determinism. – Marcin Apr 05 '12 at 08:38
  • Perhaps you might get more of an answer if you specified which variant. – Dan Apr 05 '12 at 08:55
  • @Marcin I think he is talking about a finding if a given hand is a wining hand that ends the game. This is indeed deterministic. – Ido.Co Apr 05 '12 at 10:33
  • @ Dan, currently, an variant will do. I am not specifically any kind of mahjong but I will follow the easier one at first. – user1285419 Apr 05 '12 at 15:58
  • A nice answer is available on there: http://stackoverflow.com/questions/4154960/algorithm-to-find-streets-and-same-kind-in-a-hand – Rémi Apr 14 '15 at 07:33

1 Answers1

3

There is this cool Python library that can be used for scoring of a Mahjong hand given a situation. I know you are working in C++, but since python is highly readable, even to non-python coders, maybe you'll be able to copy/paste and edit the relevant part so you'll be able to use them.

Hope that helps you in some way.

Ido.Co
  • 5,317
  • 6
  • 39
  • 64