A Lookup Table for Deficiency Number Calculation in Mahjong
摘要
In the game of Mahjong, the deficiency number is an important metric to judge the quality of a given hand. Calculating this number on-the-fly using traditional methods, such as depth-first search, is time consuming. In this paper, we propose a formula for the deficiency number and design a greedy method to build a lookup table in advance, allowing for more efficient calculations. While using these tables, we introduce two methods to handle some special cases, named hidden tiles and pseudo-meld prioritization. By applying these methods, we ensure the correctness when using these tables. The experimental results show a speedup of 121.2 times compared to VeryLongCat and 6868.9 times compared to Botzone.