Mahjong auxiliary decision-making method and system based on reinforcement learning and tile combining efficiency algorithm

By adopting reinforcement learning and card efficiency algorithms in mahjong games, a mahjong game neural network model based on PPO algorithm was constructed, which solved the problems of difficulty in capturing AI decision logic and low training efficiency in the existing technology, and achieved higher card sum Probability and card power.

CN119129653APending Publication Date: 2024-12-13CHENGDU POTENTIAL ARTIFICIAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411150914.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively capture and simulate the decision logic and intuitive judgment of human experts in mahjong games. The performance of convolutional neural networks is limited, which limits the card power of AI, and imitation learning is easy to fall into local optimality and has low training efficiency.

Method used

Using Mahjong-assisted decision-making method based on reinforcement learning and card efficiency algorithms, using Python to create a mahjong card environment, and using Pytorch to build a mahjong game neural network model based on PPO algorithm, including action networks and value networks, through distributed training and attention The mechanism improves training efficiency and card strength.

Benefits of technology

It significantly improves the training speed and card sum probability, realizes the quantification of contribution to each card-playing action, obtains a higher card sum probability, and improves the card strength and decision-making efficiency of AI.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129653A_ABST
    Figure CN119129653A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of artificial intelligence, and relates to a mahjong assistant decision-making method and system based on reinforcement learning and a mahjong efficiency algorithm. The method comprises the following steps: creating a mahjong game environment; constructing a mahjong game neural network model based on a PPO algorithm; performing mahjong match in each sub-process; obtaining a historical mahjong match data set; training the mahjong match neural network model in the host process, and scoring based on a mahjong efficiency algorithm; updating parameters of the action network and parameters of the value network; and performing mahjong match by using the action network of the mahjong match neural network model, the AI based on the random rule and the AI constructed based on the mahjong efficiency algorithm to obtain the reinforcement learning mahjong match neural network model. According to the invention, a sample data set is obtained through a card efficiency algorithm to realize model training, and quantification of training intensity is realized; and the training process of the model is guided by using a card efficiency algorithm, so that the training speed is remarkably improved, and a higher card matching probability can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular, relates to a mahjong auxiliary decision-making method and system based on reinforcement learning and card efficiency algorithm. Background Art

[0002] Mahjong is a challenging multiplayer strategy game. Its complexity comes not only from the huge state space and action space, but also involves incomplete information between players, highly dynamic game situations and rich strategic interactions. In Mahjong, traditional rule-based or heuristic methods are difficult to fully capture and simulate the decision-making logic and intuitive judgment of human masters. Although deep learning-based models perform well in processing high-dimensional inputs, they often lack effective strategy exploration and optimization mechanisms.

[0003] The existing technology uses a neural network model to output card-playing actions. Due to the limited performance of convolutional neural networks, convolution is usually good at capturing short-distance features but poor performance on long-distance features, which limits the card strength of AI. The imitation learning setting makes it easy for AI to fall into local optimality and its card strength is limited. The non-distributed training method has low training efficiency. Summary of the invention

[0004] In order to solve the above technical problems, the present invention provides a mahjong auxiliary decision-making method and system based on reinforcement learning and card efficiency algorithm.

[0005] In a first aspect, the present invention provides a mahjong auxiliary decision-making method based on reinforcement learning and card efficiency algorithm, comprising:

[0006] Use Python to create a mahjong game environment, create a mahjong game AI based on random rules, and create a mahjong game AI based on a card efficiency algorithm;

[0007] Use Pytorch to build a mahjong game neural network model based on the PPO algorithm, including action network and value network;

[0008] Create a main process and multiple sub-processes, each sub-process copies an action network;

[0009] In each sub-process, the action network is used to play mahjong in the mahjong game environment, the card information in the current mahjong game data is obtained, the card information is used as the input of the action network, the probability corresponding to the card result is used as the output of the action network, and the card result is sampled and selected according to the probability corresponding to the card result;

[0010] Use action networks to obtain historical mahjong game datasets;

[0011] Randomly sample from the historical mahjong game data set, train the mahjong game neural network model based on the PPO algorithm in the main process, use the action network to obtain the probability corresponding to each card-playing result, use the value network to score each card-playing result to obtain the score corresponding to each card-playing result, and adjust the probability corresponding to each card-playing result obtained by the action network according to the score corresponding to each card-playing result;

[0012] After each training for a first set number of times, the parameters of the mahjong game neural network model in the main process are passed to each sub-process, and the parameters of the action network that obtains the historical mahjong game data in each sub-process are updated;

[0013] After each training of the second set number of times, the action network of the mahjong game neural network model in the main process is used to play mahjong games with the AI ​​based on random rules and the AI ​​built based on the card efficiency algorithm. When the winning probability of the mahjong game neural network model in the second set number of training results exceeds the set ratio, the training is terminated to obtain the trained reinforcement learning mahjong game neural network model;

[0014] The card information of the current mahjong game is obtained in real time, and the player hand value scoring matrix of the current player's hand cards in the current mahjong game data is obtained. The mahjong game is played using the reinforcement learning mahjong game neural network model, and the card-playing result is output.

[0015] In a second aspect, the present invention provides a mahjong auxiliary decision-making system based on reinforcement learning and card efficiency algorithm, including a creation unit, a model construction unit, a process creation unit, a sub-process processing unit, a data set construction unit, a training unit, a first network parameter updating unit, a second network parameter updating unit and a data processing unit;

[0016] Create a unit for building a mahjong game neural network model based on the PPO algorithm using Pytorch, including the action network and the value network;

[0017] The model building unit is used to use Pytorch to build a mahjong game neural network model based on the PPO algorithm, including an action network and a value network;

[0018] The process creation unit is used to create a main process and multiple sub-processes, each of which copies an action network;

[0019] The sub-process processing unit is used to use the action network to play mahjong in the mahjong game environment in each sub-process, obtain the card information in the current mahjong game data, use the card information as the input of the action network, use the probability corresponding to the card-playing result as the output of the action network, and sample and select the card-playing result according to the probability corresponding to the card-playing result;

[0020] A data set construction unit, used to obtain a historical mahjong game data set using an action network;

[0021] A training unit is used to randomly sample from a historical mahjong game data set, train a mahjong game neural network model based on the PPO algorithm in the main process, obtain the probability corresponding to each card-playing result using the action network, score each card-playing result using the value network to obtain the score corresponding to each card-playing result, and adjust the probability corresponding to each card-playing result obtained using the action network according to the score corresponding to each card-playing result;

[0022] A first network parameter updating unit is used to transfer the parameters of the mahjong game neural network model in the main process to each sub-process after each training for a first set number of times, and to update the parameters of the action network that obtains the historical mahjong game data in each sub-process;

[0023] A second network parameter updating unit is used to use the action network of the mahjong game neural network model in the main process to play mahjong games with the mahjong game AI based on random rules and the mahjong game AI constructed based on the card efficiency algorithm after each training of the second set number of times, and when the winning probability of the mahjong game neural network model in the second set number of training results exceeds the set ratio, the training is terminated to obtain the trained reinforcement learning mahjong game neural network model;

[0024] The processing unit is used to obtain the card information of the current mahjong game in real time, obtain the player hand value scoring matrix of the current player's hand in the current mahjong game data, use the reinforcement learning mahjong game neural network model to play the mahjong game, and output the card-playing result.

[0025] Based on the above technical solution, the present invention can also be improved as follows.

[0026] Furthermore, the card information includes the current player's hand, the action cards played by all players, the cards all players have played, and the number of each type of card remaining in the game.

[0027] Furthermore, based on the card efficiency algorithm, each card-playing result in the card information is scored to obtain the value score of each hand card, and the value score is converted into a matrix to obtain the value score matrix of the current player's hand cards in the historical mahjong game data;

[0028] A sample data set is constructed using the card information in historical mahjong game data and the value scoring matrix of the current player's hand cards in historical mahjong game data.

[0029] Furthermore, the output of the last layer of the action network is a fully connected layer of 34 units, representing the executed action; the last layer of the value network is a fully connected layer that outputs a single number to obtain the value scores of different states.

[0030] Furthermore, the action cards played by all players include playing target hand cards, pong cards, kong cards and tie cards.

[0031] Furthermore, the reinforcement learning neural network model is a Transformer-based Encoder architecture, in which each input performs an attention mechanism operation with the next input; n layers of Encoder Layer are superimposed, and finally connected to a fully connected layer.

[0032] Furthermore, the mahjong game neural network model based on the PPO algorithm is trained in the main process using a worker-trainer distributed training method; a single worker process includes three agents, one neural network model and one mahjong environment; the three agents are all based on the reinforcement learning neural network model, and play against each other in the same mahjong environment to generate game data; the trainer includes a reinforcement learning neural network model being trained and a container for loading historical game data. After each training step set, the trainer synchronizes the reinforcement learning neural network model parameters to each worker, updates the reinforcement learning neural network model parameters, and generates the next set of training data.

[0033] The beneficial effects of the present invention are as follows: the present invention obtains a sample data set through a card efficiency algorithm to realize the training of a reinforcement learning neural network model with an added attention mechanism, realizes the quantification of training intensity, quantifies the contribution of each card playing action to the progress of approaching a winning condition, and obtains the scoring potential when the final winning condition is achieved; the card efficiency algorithm is used to guide the training process of the reinforcement learning neural network model, which significantly improves the training speed; the reinforcement learning neural network model obtained by the present invention based on the card efficiency algorithm can obtain a higher winning probability. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A schematic diagram of a mahjong decision-making assistance method based on reinforcement learning and card efficiency algorithm provided in Example 1 of the present invention;

[0035] Figure 2 This is a schematic diagram of a mahjong decision support system based on reinforcement learning and card efficiency algorithm provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0037] Example 1

[0038] As an example, Figure 1 As shown, in order to solve the above technical problems, this embodiment provides a mahjong auxiliary decision-making method based on reinforcement learning and card efficiency algorithm, including:

[0039] Use Python to create a mahjong game environment, create a mahjong game AI based on random rules, and create a mahjong game AI based on a card efficiency algorithm;

[0040] Use Pytorch to build a mahjong game neural network model based on the PPO algorithm, including action network and value network;

[0041] Create a main process and multiple sub-processes, each sub-process copies an action network;

[0042] In each sub-process, the action network is used to play mahjong in the mahjong game environment, the card information in the current mahjong game data is obtained, the card information is used as the input of the action network, the probability corresponding to the card result is used as the output of the action network, and the card result is sampled and selected according to the probability corresponding to the card result;

[0043] Use action networks to obtain historical mahjong game datasets;

[0044] Randomly sample from the historical mahjong game data set, train the mahjong game neural network model based on the PPO algorithm in the main process, use the action network to obtain the probability corresponding to each card-playing result, use the value network to score each card-playing result to obtain the score corresponding to each card-playing result, and adjust the probability corresponding to each card-playing result obtained by the action network according to the score corresponding to each card-playing result;

[0045] After each training for a first set number of times, the parameters of the mahjong game neural network model in the main process are passed to each sub-process, and the parameters of the action network that obtains the historical mahjong game data in each sub-process are updated;

[0046] After each training of the second set number of times, the action network of the mahjong game neural network model in the main process is used to play mahjong games with the AI ​​based on random rules and the AI ​​built based on the card efficiency algorithm. When the winning probability of the mahjong game neural network model in the second set number of training results exceeds the set ratio, the training is terminated to obtain the trained reinforcement learning mahjong game neural network model;

[0047] The card information of the current mahjong game is obtained in real time, and the player hand value scoring matrix of the current player's hand cards in the current mahjong game data is obtained. The mahjong game is played using the reinforcement learning mahjong game neural network model, and the card-playing result is output.

[0048] The PPO algorithm (Proximal Policy Optimization) can effectively avoid drastic fluctuations in strategy performance and improve the stability and efficiency of training by optimizing the update steps of the proxy strategy. The PPO algorithm can dynamically adjust the playing strategy in each game based on the current cards, the common cards that all players have played, and the historical cards. The PPO algorithm is applied to Mahjong as a strategy evaluation method to help players make the most efficient decisions in the process of playing cards, reach a tie state as quickly as possible, and consider potential point gains. The core of this algorithm is to quantify the contribution of each playing choice to the progress towards a tie, and consider the scoring potential when the final tie is reached.

[0049] In the actual application process, after every 10 trainings, the parameters of the mahjong game neural network model in the main process are passed to each sub-process, and the parameters of the action network that obtains the historical mahjong game data in each sub-process are updated to make the mahjong game quality higher; after every 100 trainings, the action network of the mahjong game neural network model in the main process is used to play mahjong games with AI based on random rules and AI built based on card efficiency algorithms. When the probability of a winning hand of the mahjong game neural network model exceeds 30% in the 100 training results, the training is terminated to obtain a trained reinforcement learning mahjong game neural network model.

[0050] Use the card efficiency algorithm to guide the training of the neural network model and accelerate the convergence process of the model. The probability of winning a hand with AI based on random rules generally does not exceed 30%. Using this card efficiency AI to quantify the neural network AI, a 40% winning probability can be obtained in the process of playing against AI based on random rules.

[0051] Optionally, the card information includes the current player's hand, the action cards played by all players, the cards all players have played, and the number of each type of card remaining in the game.

[0052] Optionally, score each card-playing result in the card information based on a card efficiency algorithm to obtain a value score for each hand of cards, convert the value score into a matrix, and obtain a value score matrix of the current player's hand in the historical mahjong game data;

[0053] A sample data set is constructed using the card information in historical mahjong game data and the value scoring matrix of the current player's hand cards in historical mahjong game data.

[0054] Optionally, the output of the last layer of the action network is a fully connected layer of 34 units, representing the action performed; the last layer of the value network is a fully connected layer that outputs a single number to obtain the value scores of different states.

[0055] Optionally, the action cards played by all players include playing target hand cards, pong cards, kong cards and tie cards.

[0056] Optionally, the reinforcement learning neural network model is a Transformer-based Encoder architecture, where each input performs an attention mechanism operation with the next input; n layers of Encoder Layer are superimposed, and finally connected to a fully connected layer.

[0057] Optionally, the mahjong game neural network model based on the PPO algorithm is trained in the main process using a worker-trainer distributed training method; a single worker process includes three agents, one neural network model and one mahjong environment; the three agents are all based on the reinforcement learning neural network model, and play against each other in the same mahjong environment to generate game data; the trainer includes a reinforcement learning neural network model being trained and a container for loading historical game data. After each training step set, the trainer synchronizes the reinforcement learning neural network model parameters to each worker, updates the reinforcement learning neural network model parameters, and generates the next set of training data.

[0058] Experiments show that the winning probability is 35%-40% in games against random AI, 25%-30% in games against existing rule-based AI based on card efficiency algorithms, and more than 30% in games against human players.

[0059] The present invention uses the PPO distributed reinforcement learning strategy to construct a target reinforcement learning neural network model with an attention mechanism, and plays games with random AI to increase the probability of winning to between 35% and 40%. During the training process, after updating the parameters 10 times, the reinforcement learning neural network model is used to play games with the rule AI to display its winning probability. The target reinforcement learning neural network model finally obtained a winning probability of about 40% in 1,000 games with the rule AI, while the winning probabilities of the other two rule AIs were between 25% and 30%.

[0060] The present invention obtains a sample data set through a card efficiency algorithm to realize the training of a reinforcement learning neural network model with an added attention mechanism, realizes the quantification of training intensity, quantifies the contribution of each card playing action to the progress of approaching a winning condition, and obtains the scoring potential when the final winning condition is reached; the card efficiency algorithm is used to guide the training process of the reinforcement learning neural network model, which significantly improves the training speed; the reinforcement learning neural network model obtained by the present invention based on the card efficiency algorithm can obtain a higher winning probability.

[0061] Example 2

[0062] Based on the same principle as the method shown in Example 1 of the present invention, as shown in the attached Figure 2 As shown, an embodiment of the present invention also provides a mahjong auxiliary decision system based on reinforcement learning and card efficiency algorithm, including a creation unit, a model construction unit, a process creation unit, a sub-process processing unit, a data set construction unit, a training unit, a first network parameter updating unit, a second network parameter updating unit and a data processing unit;

[0063] Create a unit for building a mahjong game neural network model based on the PPO algorithm using Pytorch, including the action network and the value network;

[0064] The model building unit is used to use Pytorch to build a mahjong game neural network model based on the PPO algorithm, including an action network and a value network;

[0065] The process creation unit is used to create a main process and multiple sub-processes, each of which copies an action network;

[0066] The sub-process processing unit is used to use the action network to play mahjong in the mahjong game environment in each sub-process, obtain the card information in the current mahjong game data, use the card information as the input of the action network, use the probability corresponding to the card-playing result as the output of the action network, and sample and select the card-playing result according to the probability corresponding to the card-playing result;

[0067] A data set construction unit, used to obtain a historical mahjong game data set using an action network;

[0068] A training unit is used to randomly sample from a historical mahjong game data set, train a mahjong game neural network model based on the PPO algorithm in the main process, obtain the probability corresponding to each card-playing result using the action network, score each card-playing result using the value network to obtain the score corresponding to each card-playing result, and adjust the probability corresponding to each card-playing result obtained using the action network according to the score corresponding to each card-playing result;

[0069] A first network parameter updating unit is used to transfer the parameters of the mahjong game neural network model in the main process to each sub-process after each training for a first set number of times, and to update the parameters of the action network that obtains the historical mahjong game data in each sub-process;

[0070] A second network parameter updating unit is used to use the action network of the mahjong game neural network model in the main process to play mahjong games with the mahjong game AI based on random rules and the mahjong game AI constructed based on the card efficiency algorithm after each training of the second set number of times, and when the winning probability of the mahjong game neural network model in the second set number of training results exceeds the set ratio, the training is terminated to obtain the trained reinforcement learning mahjong game neural network model;

[0071] The processing unit is used to obtain the card information of the current mahjong game in real time, obtain the player hand value scoring matrix of the current player's hand in the current mahjong game data, use the reinforcement learning mahjong game neural network model to play the mahjong game, and output the card-playing result.

[0072] Optionally, the card information includes the current player's hand, the action cards played by all players, the cards all players have played, and the number of each type of card remaining in the game.

[0073] Optionally, score each card-playing result in the card information based on a card efficiency algorithm to obtain a value score for each hand of cards, convert the value score into a matrix, and obtain a value score matrix of the current player's hand in the historical mahjong game data;

[0074] A sample data set is constructed using the card information in historical mahjong game data and the value scoring matrix of the current player's hand cards in historical mahjong game data.

[0075] Optionally, the output of the last layer of the action network is a fully connected layer of 34 units, representing the action performed; the last layer of the value network is a fully connected layer that outputs a single number to obtain the value scores of different states.

[0076] Optionally, the action cards played by all players include playing target hand cards, pong cards, kong cards and tie cards.

[0077] Optionally, the reinforcement learning neural network model is a Transformer-based Encoder architecture, where each input performs an attention mechanism operation with the next input; n layers of Encoder Layer are superimposed, and finally connected to a fully connected layer.

[0078] Optionally, the mahjong game neural network model based on the PPO algorithm is trained in the main process using a worker-trainer distributed training method; a single worker process includes three agents, one neural network model and one mahjong environment; the three agents are all based on the reinforcement learning neural network model, and play against each other in the same mahjong environment to generate game data; the trainer includes a reinforcement learning neural network model being trained and a container for loading historical game data. After each training step set, the trainer synchronizes the reinforcement learning neural network model parameters to each worker, updates the reinforcement learning neural network model parameters, and generates the next set of training data.

[0079] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. Mahjong auxiliary decision-making method based on reinforcement learning and card efficiency algorithm, It is characterized in that include: Use Python to create a mahjong game environment, create a mahjong game AI based on random rules, and create a mahjong game AI based on a card efficiency algorithm; Use Pytorch to build a mahjong game neural network model based on the PPO algorithm, including action network and value network; Create a main process and multiple sub-processes, each sub-process copies an action network; In each sub-process, the action network is used to play mahjong in the mahjong game environment, the card information in the current mahjong game data is obtained, the card information is used as the input of the action network, the probability corresponding to the card result is used as the output of the action network, and the card result is sampled and selected according to the probability corresponding to the card result; Use action networks to obtain historical mahjong game datasets; Randomly sample from the historical mahjong game data set, train the mahjong game neural network model based on the PPO algorithm in the main process, use the action network to obtain the probability corresponding to each card-playing result, use the value network to score each card-playing result to obtain the score corresponding to each card-playing result, and adjust the probability corresponding to each card-playing result obtained by the action network according to the score corresponding to each card-playing result; After each training for a first set number of times, the parameters of the mahjong game neural network model in the main process are passed to each sub-process, and the parameters of the action network that obtains the historical mahjong game data in each sub-process are updated; After each training of the second set number of times, the action network of the mahjong game neural network model in the main process is used to play mahjong games with the AI ​​based on random rules and the AI ​​built based on the card efficiency algorithm. When the winning probability of the mahjong game neural network model in the second set number of training results exceeds the set ratio, the training is terminated to obtain the trained reinforcement learning mahjong game neural network model; The card information of the current mahjong game is obtained in real time, and the player hand value scoring matrix of the current player's hand cards in the current mahjong game data is obtained. The mahjong game is played using the reinforcement learning mahjong game neural network model, and the card-playing result is output.

2. According to the mahjong decision-making auxiliary method based on reinforcement learning and card efficiency algorithm according to claim 1, It is characterized in that The card information includes the current player's hand, the action cards played by all players, the cards all players have played, and the number of each type of card remaining in the game.

3. According to the mahjong auxiliary decision-making method based on reinforcement learning and card efficiency algorithm according to claim 1, It is characterized in that Based on the card efficiency algorithm, score each card-playing result in the card information to obtain the value score of each hand card, convert the value score into a matrix, and obtain the value score matrix of the current player's hand cards in the historical mahjong game data; A sample data set is constructed using the card information in historical mahjong game data and the value scoring matrix of the current player's hand cards in historical mahjong game data.

4. According to the mahjong decision-making auxiliary method based on reinforcement learning and card efficiency algorithm according to claim 1, It is characterized in that The output of the last layer of the action network is a fully connected layer of 34 units, representing the executed action; the last layer of the value network is a fully connected layer that outputs a single number to obtain the value scores of different states.

5. According to the mahjong auxiliary decision-making method based on reinforcement learning and card efficiency algorithm according to claim 2, It is characterized in that The action cards played by all players include playing the target hand, pong, kong and tie.

6. The mahjong decision-making assistance method based on reinforcement learning and card efficiency algorithm according to claim 1, It is characterized in that The reinforcement learning neural network model is a Transformer-based Encoder architecture. Each input will perform an attention mechanism operation with the next input. It uses a superposition of n layers of Encoder Layers and finally connects to a fully connected layer.

7. The mahjong decision-making assistance method based on reinforcement learning and card efficiency algorithm according to claim 1, It is characterized in that In the main process, the worker-trainer distributed training method is used to train the mahjong game neural network model based on the PPO algorithm; a single worker process includes 3 intelligent agents, 1 neural network model and 1 mahjong environment; the 3 intelligent agents are all based on the reinforcement learning neural network model, and play against each other in the same mahjong environment to generate game data; the trainer includes a reinforcement learning neural network model being trained and a container for loading historical game data. After each training step, the trainer synchronizes the reinforcement learning neural network model parameters to each worker, updates the reinforcement learning neural network model parameters, and generates the next set of training data.

8. Mahjong auxiliary decision-making system based on reinforcement learning and card efficiency algorithm, It is characterized in that It includes a creation unit, a model construction unit, a process creation unit, a sub-process processing unit, a data set construction unit, a training unit, a first network parameter updating unit, a second network parameter updating unit and a data processing unit; Create a unit for building a mahjong game neural network model based on the PPO algorithm using Pytorch, including the action network and the value network; The model building unit is used to use Pytorch to build a mahjong game neural network model based on the PPO algorithm, including an action network and a value network; The process creation unit is used to create a main process and multiple sub-processes, each of which copies an action network; The sub-process processing unit is used to use the action network to play mahjong in the mahjong game environment in each sub-process, obtain the card information in the current mahjong game data, use the card information as the input of the action network, use the probability corresponding to the card-playing result as the output of the action network, and sample and select the card-playing result according to the probability corresponding to the card-playing result; A data set construction unit, used to obtain a historical mahjong game data set using an action network; A training unit is used to randomly sample from a historical mahjong game data set, train a mahjong game neural network model based on the PPO algorithm in the main process, obtain the probability corresponding to each card-playing result using the action network, score each card-playing result using the value network to obtain the score corresponding to each card-playing result, and adjust the probability corresponding to each card-playing result obtained using the action network according to the score corresponding to each card-playing result; A first network parameter updating unit is used to transfer the parameters of the mahjong game neural network model in the main process to each sub-process after each training for a first set number of times, and to update the parameters of the action network that obtains the historical mahjong game data in each sub-process; A second network parameter updating unit is used to use the action network of the mahjong game neural network model in the main process to play mahjong games with the mahjong game AI based on random rules and the mahjong game AI constructed based on the card efficiency algorithm after each training of the second set number of times, and when the winning probability of the mahjong game neural network model in the second set number of training results exceeds the set ratio, the training is terminated to obtain the trained reinforcement learning mahjong game neural network model; The processing unit is used to obtain the card information of the current mahjong game in real time, obtain the player hand value scoring matrix of the current player's hand in the current mahjong game data, use the reinforcement learning mahjong game neural network model to play the mahjong game, and output the card-playing result.