Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 7, No. 3, 2024 38 Study of Road‐based Versus Pattern‐based Game Strategies in Connect6 Yang Cao a, Meina Zhang *, Simiao Jia, Yaqin Shang, Xianjun Wang University of Science and Technology Liaoning, Anshan Liaoning, 114000, China * Corresponding author: Meina Zhang (Email: zhangmeina@163.com), a 2557436813@qq.com Abstract: Computer game is an important branch in the field of artificial intelligence research nowadays, and the in-depth study of computer game can not only promote the development of game theory, but also contribute to the development of artificial intelligence. In this paper, for the game search strategy of connect6, according to the two most widely used search strategies and valuation function design, one is the valuation strategy based on the road, and the other is the valuation method based on the chess type, under the PVS search algorithm, the principle and implementation of these two search strategies are introduced in detail, and at the same time, the advantages and disadvantages of the two methods are compared, so as to provide the decision- making policy and the design of valuation function for the game of connect6 a more reasonable reference. Through comparison, it can be seen that in hexachrome, due to the complexity of the evaluation function and game strategy based on chess shapes, it requires the game programme to have a strong recognition of chess shapes, and the complexity of accurately evaluating the advantages and disadvantages of the position is higher. The road-based game strategy has better accuracy in evaluating and predicting the game, and can effectively reduce the game failure due to positional judgement errors. Keywords: Connect6; Road; Chess Type; Valuation Function; Game Strategy. 1. Introduction Machine gaming is a popular research direction in current artificial intelligence research and is an integral part of the field of artificial intelligence. Its research results and technological advances have contributed visible theories and methods to the research in the field of artificial intelligence, and have had a long-lasting impact on the development of natural science and academic progress. Nowadays, scientific and technological competitions with the theme of computer gaming are becoming more and more popular, such as the International Computer Olympiad and the National Student Computer Gaming Competition. The purpose of holding the competitions is to better promote the development of machine gaming technology and the progress of artificial intelligence technology. Regardless of the general direction of artificial intelligence or small direction of computer gaming, its core purpose is to be able to efficiently and realistically simulate the human brain thinking, hoping that through a high degree of simulation of human thinking methods and thinking ability to achieve the level of human technology, instead of human work, and in this way to be able to exceed the human thinking, to complete the tasks that human beings cannot complete. In the field of computer gaming, chess computer games are flourishing, including Rokko, Tibetan Kyuqi, Go, Backgammon, Xiangqi, Surakarta, and so on. The gaming technology of each type of chess is of academic significance for in-depth development and research. The field of chess computer gaming has been fruitful from the excellent results achieved by computer gaming programmes in chess in 1997 to Alpha-Go Zero in 2017. As an important type of chess game, Rokko evolved on the basis of backgammon, and the complexity of its board position is second only to that of Weiqi, which is comparable to that of Xiangqi, so it has a high academic research value and development potential. 2. Outline of Six Pawns Hexagram is a variant of backgammon whose origins can be traced back to backgammon, an ancient board game with a long history of origin in China. It is rumoured that backgammon first appeared in China during the Song Dynasty, and then gradually became popular all over the world and became a highly popular board game. Unlike backgammon, hexagonal chess requires players to take more factors into consideration when placing pieces in order to increase the complexity and challenge of the game, and at the same time, hexagonal chess introduces a number of new rules and variations that make the game richer and more interesting. Traditional Chinese Six-Piece Chess is a widely circulated folk chess game in which both players play against each other, and the one who is the first to get six consecutive pieces on the board is the winner. Connect6is a variant of five pieces, and its origin can be traced back to five pieces. Modern connect6belongs to one of the K pieces series proposed by Professor Wu Yi-Cheng of the National Chiao Tung University in Taiwan. The rules of Rokugo are similar to those of traditional backgammon. At first, each player holds black and white, and the player holding black is the first to drop a piece on the board. After that, both black and white take turns to drop two pieces on the board each turn, and the player who is the first to get connect6in a straight line horizontally, vertically, and diagonally wins the game, and if the board is full and no one gets a win, the game will be ruled as a draw. Currently, the 19-channel board of Weiqi is commonly used in the game of Rokuji. Because of the two discs per move per round, the game variations of Hexachrome are very complex, with a large number of combinations, and its complexity is second only to that of Weiqi. For machine games, the complexity of the game is usually described by the size of the state space (the number 39 of states in all games) and the complexity of the game tree during the search process. In the case of a 19×19 hexagonal game, the state space can be as large as10 and the game tree complexity can be up to10 The complexity of the game is obvious. 3. Game Strategies based on Chess Patterns Search strategy based on "chess shape" means that in the process of scanning the chess board, the game programme searches and makes decisions based on the current situation and shape of the game. Since the discs are fixed, the situation can be determined by analysing the shape of the discs in their positions. In the game of hexachrome, the shapes can be basically classified into several types as shown in Figure 1. (1) Sleep two (2) Live II (3) Sleep three (4) Live three (5) Live IV (6) Sleep IV (7) Live Five (8) Sleep V (9) Six companies Figure 1. Connect6 Pattern 40 These are just the basic 9 shapes, and there are 19 common ones. In games, there are often situations where multiple shapes cross over each other, so there are actually more than that. Each type of disc has a different degree of influence on the game situation, as well as a different value of the discs. The search strategy based on "chess shape" firstly needs to scan the board for chess shapes, from the upper left corner of the board to the lower right corner of the board, and for each scanned piece, check the connecting discs of the piece in the four directions of up, down, left, right and left, and judge whether there are discs of the same colour, and if there are, judge to what kind of chess shape they belong to. In the search process, the scanning of chess shapes often adopts the strategy of local search. Here, the design of the valuation function will be based on "moves", and for each different move shape, different values will be assigned to each move shape according to its characteristics and the significance of its moves. For example, the move "live three" is a threatening move shape, which only needs to form a "continuous five" on the next move. For example, the "live 3" is a threatening move which can be formed by simply making a five on the next move, and its value is higher than that of the "live 2", so you can assign a higher value to the "live 3" than to the "live 2", and the amount of value you need to assign to each type of move needs to be determined in the course of many games. For how much value should be assigned to each shape, it is necessary to get a reasonable result in many games, and a reasonable valuation will largely affect the value judgement of the program on the current position, and influence the generation of the next move. Usually, in order to improve the efficiency of search, this search strategy often adopts a high degree of model matching algorithm, which requires the computer to accurately locate the chess shapes, so the computer's efficiency in accurately determining the positional shapes is the key to measuring the strength of the "chess shape"-based search strategy. 4. Road-based Gaming Strategies In the realm of the game of hexachrome, there exists another search strategy, based on "paths". A "road" is a point on the board where six neighbouring pieces may be formed in succession. In reality, roads have directions, such as east, west, south, north, and south. Similarly, the "road" on the board also has direction. According to the four directions of horizontal, vertical, left diagonal, and right diagonal, we can calculate the "number of roads" in each direction on a 19×19 board, and in the horizontal direction, there are 19 rows × (19-6+1)/ rows = 266 roads. There are 19 rows x (19-6+1)/columns = 266 roads in the horizontal direction, 19 columns x (19-6+1)/columns = 266 roads in the vertical direction, 14 rows x (19-6+1)/ rows = 196 roads in the left diagonal direction, 19 columns x (19- 6+1)/columns = 196 roads in the right diagonal direction, so there are a total of 924 roads in the 19×19 board, and if we use the term "road" to replace "road", we can calculate the "number of roads" in each direction of the 19×19 board. If we use "roads" instead of "shapes" to value the situation, then in the game search process, we will be able to reduce the errors caused by slow search speed and inaccurate move generation due to the lack of accuracy in judgement of shapes. At the same time, the search strategy and valuation function will also be redesigned and optimised. When designing this search strategy, we adopt object- oriented thinking and define "road" as a class, which can include many attributes in the chess game. For example, the number of pieces of the same colour on the road can be taken as one of the attributes of the road, and by judging the number of pieces of the same colour, we can get whether the road has the value of walking or not. Through this design, we can rationalise the transformation of chess shapes into paths. Figure 2. The pseudo-code of the search strategy By adopting the idea of path decision-making, a hexagonal chess game system only needs to value the board according to the "paths" and calculate the state value of the board without making judgement on the shapes of the pieces. But there are already several paths with different number of pieces, which path is better, and which "path" is a straight kill or defeat? This in turn leads to the problem of evaluating and 41 judging the state of the game in game strategy [1]. Based on the evaluation of the state of the game in the "chess shape" strategy, it is inspired to propose the concept of "net winning paths". If your side has k n-paths and your opponent has h n- paths (n represents the number of consecutive pieces of the same colour on the path), then the net winning n-paths are (k) - h (k > h) (k > h). -h) (k>h, n<=6), with different net wins corresponding to different values and scores. Here, we go back to the game evaluation and valuation function design previously proposed for the "chess shape" model matching algorithm. Based on the idea of "road", the search strategy of road is designed. The design of the search strategy is as follows: Before each move, the empty space points on the board are evaluated, and then a part of the points with higher scores are selected, and these points are arranged and combined to obtain multiple ways of playing, and these ways of playing are simulated on the board, and the current position is scored according to the number of net winning paths in the current position through simulation of the move, and if the scores are higher, the way of playing is more reasonable. The Alpha- Beta pruning algorithm will be used as the search algorithm for Hexagram, and the pseudo-code of the search strategy is shown in Figure 2. The "road" based game strategy can accurately evaluate the position of the current search node in the hexagonal chess game. Similarly, the scores assigned by the evaluation function to different net winning paths are also subject to the limitations of experience, and the value judgement of different positions needs to be optimised in several games. However, under the same search algorithm, the game strategy based on "paths" can effectively optimise the search judgement time. 5. Conclusion In order to reasonably compare and analyse, under the premise that the same search algorithm is used to implement the two game strategies, a comparison experiment is designed for hexachrome based on different game state representations, which is divided into two cases of forehand and backhand to compare the advantages and disadvantages of the game strategies based on the "chess shape" and the "road". "The results are shown in Table 1. Table 1. Comparison of the results of the gaming strategies Number of games played The number of road-based game strategy wins Winning rate/ percent one after the other 542 519 95.75% masterstroke 489 435 88.95% backhanders As shown in Table 1, the game strategy based on "road" has an advantage over the game strategy based on "chess shape" in the case of the same search algorithm. This paper gives a detailed introduction and comparative study of two common search strategies in current hexachrome machine games, based on "chess shape" and "road". The results show that the "road"-based game strategy has a better advantage than the "shape"-based game strategy in time- limited games. As machine games are designed on many levels of knowledge, the authors only provide a reasonable overview and comparison of the two game strategies with their knowledge of hexachrome games, hoping to bring some gains to the readers. Acknowledgments Fund: 2024 Innovation and entrepreneurship training program for College Students. References [1] Zhang S. Chuan, Chen G. N., Zhang S. Q. et al. Evaluation function of hexagonal chess game[J]. Journal of Chongqing University of Technology (Natural Science Edition),2010,24 (02): 64-68. [2] He Xuan, Hong Yingwei, Wang Kaiyi et al. Analysis of the main techniques of machine gaming--Taking connect6chess as an example[J]. Computer Knowledge and Technology, 2019, 15 (33): 172-173. DOI: 10. 14004/ j.cnki.ckt.2019.3964. [3] H.F. Wang, J.W. Wang, Y.Y. Li. A study on hexachrome gaming system based on PVS algorithm[J]. Intelligent Computer and Application,2021,11(02):97-100. [4] LI Xia-Li, WU Li-Cheng, LI Yong-Ji. Research on computer game of Tibetan "jiu" chess based on chess type[J]. Journal of Intelligent Systems,2018,13(04):577-583. [5] Qi Yifei. Research and application of road-based dual evaluation parameter evaluation function in hexachord[D]. Beijing University of Technology,2018. [6] Min W. J.. Research on key technology of connect6chess computer game[D]. Chongqing Jiaotong University,2010. [7] Cuizhu Li. Research and implementation of computer gaming system for connect6chess [D]. Chongqing University of Technology, 2010. [8] Wang Kunbing. Research and implementation of search technology in hexachrome game[D]. Anhui University,2016. [9] Xuejun Li, Xiaolong Wang, Lei Wu et al. A game tree generation algorithm based on local "road" scanning approach in hexachrome [J]. Journal of Intelligent Systems, 2015, 10 (02): 267-272.