# Official International Mahjong: A New Playground for AI Research
## 5 AI Algorithms
### Heuristic Methods  
Most of the teams in the first competition built their AI agents with heuristic methods, which rely heavily on human knowledge. For a human player, the goal of Mahjong is to make a winning hand as soon as possible by choosing the right tile to discard and stealing other players' discarded tiles to make melts when necessary. The minimal number of tiles to replace from the current hand to a winning pattern is defined as the \"shanten\" value, which is an important concept in the strategies of humans to measure their distance from winning. Some heuristic methods simply calculate the current shanten value by expanding a search tree, trying all possible tiles it can replace until it forms a winning pattern. Upon finding the shortest path to a winning pattern, the agent just keeps the useful tiles and discards a tile from those to be replaced until the shanten value drops to zero, waiting for the 14 th tile to win. However, such shanten values only reflect the distance between the current hand and a winning pattern, but the _fan_ value of the winning pattern may not be enough to win; that value must be no less than eight. Since the _fan_ value depends on a wide variety of scoring patterns that not only describe the tiles in the hand, but also the exposed or concealed state of each model and some properties of the 14 th \begin{table}
\begin{tabular}{c c c c c c c c c c c c c c c c c} \hline \hline
**Player** & \multicolumn{3}{c}{**East Wind**} & \multicolumn{3}{c}{**South Wind**} & \multicolumn{3}{c}{**West Wind**} & \multicolumn{3}{c}{**North Wind**} & \multicolumn{3}{c}{**Total**} \\ \hline [PERSON] & \(-22\) & \(32\) & \(51\) & \(-19\) & \(54\) & \(99\) & \(-8\) & \(-17\) & \(34\) & \(-8\) & \(34\) & \(-8\) & \(34\) & \(-27\) & \(-8\) & \(-16\) & \(205\) \\ \[PERSON] & \(-22\) & \(60\) & \(54\) & \(-19\) & \(54\) & \(-8\) & \(-8\) & \(-30\) & \(37\) & \(33\) & \(66\) & \(-8\) & \(35\) & \(-16\) & \(-8\) & \(-16\) & \(204\) \\ \hline Kima (AI) & \(-22\) & \(60\) & \(-8\) & \(-19\) & \(54\) & \(-8\) & \(-8\) & \(-28\) & \(-8\) & \(66\) & \(-8\) & \(35\) & \(-8\) & \(-8\) & \(-16\) & \(66\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The scores of each game in the human-versus-AI competition. Figure 4: The category of algorithms used in the top sixteen agents in the two Mahjong AI competitions. The arrows indicate that the agents were uploaded by the same team who participated in both competitions. tile, including these states in the search tree would make it too large to be traversed in limited time. Instead, human players not only try to reduce the shanten value but also think about the scoring patterns they want to make in advance. Since there are five different winning patterns in Official International Mahjong, and the strategies differ when making different patterns, some heuristic methods try to decide on a pattern to make based on the current hand and move to the pattern according to detailed strategies. These methods usually choose the pattern according to predefined rules based on the experience of human players. For example, human players tend to make the \"Seven Pairs\" pattern if there are five pairs in the current hand, and make the \"Thirteen Orphans\" pattern if there are no less than 11 terminal tiles and honor tiles. Some AI agents even consider dozens of scoring patterns as targets, choosing the target based on predefined conditions, and use different strategies for each pattern, making a complex behavior tree. After deciding which winning pattern or scoring pattern to make, more heuristics can be applied based on the targeted pattern. Some of the AI agents calculate the winning probability by the probability of occurrence of each tile based on visible information. The action is chosen based on a combination of reducing shanten values and maximizing the winning probability. All of these rely heavily on human expertise. Learning-based models can also be embedded in the behavior tree as the detailed strategies for some patterns.