I'm working on trying to identify a winning hand in mahjong, does anyone have any tips or a working formula?
The game of mahjong is like gin rummy with 13 cards, sets of 4,3 or flushes of 3. A winning hand includes the stolen or given card, which totals 14 cards. A winning hand is sets of:
There are also points associated with this.
Any guidance or help would be much appreciated. To follow up, and add info, this may help others, and gould help us to answer our own question,
I am aiming at Hong Kong Mahjong Rules. When I work through an algorithm, the one I am investigating is the removal of streets, and if fail, remove the set.
works when I have a b3333 b4 b5 b666 check b345 - remove check b345 fail, b333 is a set, remove check b678, fail, b666 is a set. none left, Winany ideas?but when I have a b222 b33 b44 b5. I need to skip and restart. check b234 ok, remove check b234 ok, remove check b234 fail, single b2 (Failed hand) restart, skip 1. check b345 ok, remove end, return to start check b234 ok remove check b234 fail, b22 is pair. none left win.
but this method is troublesome, because there could be a double state to retry. b222 b33 b44 b555 b66 b77 check b234 ok, remove check b234 ok, remove check b234 fail, resart, skip 1. check b345 ok, remove check b345 ok, remove check b567 ok, remove check b678 fail, no 7, skip one rety
I have implemented a successful mahjong game in Android. The algorithm I used was as follows:
1) Count the occurrence of each tile into an array of 34 2) Remove every possible pair 3) Recursively check the remaining tiles for triplets
Hope that helps