R-mahjong Ⅰ: break hand into sets
This mission is the beginning of a series of missions dedicated to Japanese game "riichi mahjong". In each subsequent mission, your task will become more difficult.
The meaning of riichi mahjong is to collect a certain combination of cards by discarding and taking cards. In this it resembles poker, only there are much more cards in it, and the rounds are longer. The cards in this game are called tiles, and each player has 14 of them.
In riichi, tiles come in five suits. Three of them are digital: man, pin and so; each of the digital suits contains tiles from 1 to 9. The fourth suit is dragons; it includes three types of tiles — a white dragon,...