# A Rule-Based AI Method for an Agent Playing Big Two
## 1 Introduction  
Developing an agent (artificial player) for playing a strategy game (e.g., chess, mahjong, and Big Two) is crucial [1]. The players' decision-making skills can significantly determine the outcome. The experience of playing strategy games with a developed agent can help human players to improve their decision-making skills. Human players can practice and play the game anytime they want. Playing a game will be more exciting and popular if there are smart opponents in the game [2]. The first famous agent to beat a reigning world champion in a game was the chess program called Deep Blue [3]. Since then, research on how to develop an agent that can play against human players has gained a lot of traction [4, 5]. Big Two is a multiplayer card game that is incredibly popular in China and other Asian countries. Although this game has many rule variations, it has one primary aim: each player has 13 cards and tries to discard them all as soon as possible based on valid card combinations. This study proposes an approach for developing an artificial intelligence (AI) agent to play Big Two [6, 7, 8]. Previous research has explained the framework of our web-based Big Two game [6]. Big Two requires four players to play. The game needs AI agents that can join if there are not enough players. Preliminary research in developing an AI agent has commonly used rule-based AI [9]. AI agents for playing games such as first-person shooter [10], Super Mario Bros. [11], Ms. Pac-Man [12, 13, 14], samurai [15], Battleship [16], Nomic game [17], Domineering [18], poker [19], and Xiangqi [20] have successfully been developed. One advantage of rule-based AI is its flexibility when encoding and modifying the system in the future [21]. Although some studies have developed sophisticated AI agents for playing games such as Air War [22], Mythic RPG [23], Chinese Chess [24], Sudoku [25], the fighting game [26], Star Trek [27], and Hanabi card [28], they used rule-based AI as an essential part of the new method. Developing sophisticated AI agents means they used sophisticated methods (e.g., fuzzy rule, deep learning) that involve computationally complex tasks. Other studies of multiplayer card games such as poker [29], Hearts [30; 31], Magic [32], Spades [33], 7 Wonders [34], Hanabi [35], and Scopone [36] have used rule-based AI as a baseline player as well. This research proposes a new method, named rule-based AI, for an agent playing Big Two. The novel method includes rules for situations in which two to four cards are left, there is a winning strategy, four more cards are left, and the agents are not in the control position. The rules for situations in which two, three, and four cards are left are used to select the card combination that is to be discarded based on the number of cards the AI agent has left. A winning strategy provides guidelines for the AI agent to guarantee that the AI agent will win when a win is achievable within three moves. The rules for occasions in which more than four cards are left prioritize conditionally discarding a card combination in the card class with the lower priority. If an agent is not in a control position, the agent discards a card combination of lower-class classification. We designed the rules for an AI agent who was not in a control position to include the hold-back function for checking whether the selected combination is essential for holding, and the split-card function for splitting a five-card and a pair when an opponent only has one card remaining to win. In addition, we introduced the bi-five-card function for finding two five-card combinations when the agent has more than ten cards left, and the best-five-card function for determining the best five-card combination when the agent has more than one possible five-card combination. The experimental results show that our AI agent plays well and significantly outperforms every opponent in all the experiments that have been conducted. We performed three experiments to evaluate the performance of our rule-based AI agent.