Intelligent decision-making method, system and computer equipment based on card-drawing mode
Through an intelligent decision-making method based on the card-drawing pattern, the mahjong winning rules are analyzed and a winning combination tree is established. The probability and weight of drawing cards are calculated, which solves the problems of rapid deployment and efficient decision-making of the mahjong intelligent decision-making model on the new platform and improves the user experience.
Patent Information
- Application Number
- CN202111660658.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2041-12-30
AI Technical Summary
The existing mahjong intelligent decision-making model lacks high-level player data, resulting in long decision-making time and poor user experience when operating on new platforms. Traditional machine learning algorithms require large amounts of data training and are difficult to optimize quickly.
An intelligent decision-making method based on the card-drawing pattern is adopted. By obtaining the mahjong winning rules and analyzing the hand information, a winning combination tree is established, the probability and weight of drawing cards are calculated, and the maximum expected value is selected for card-playing decision, which reduces the search depth and improves the calculation speed.
While reducing computing resource consumption, it improves the response speed of card-playing decisions and the winning score, making it suitable for the rapid deployment of high-level mahjong intelligent decision-making systems on new platforms.
Smart Images

Figure CN114307124B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of mahjong intelligent decision-making, and particularly relates to an intelligent decision-making method and system based on a card drawing mode and a computer device. BACKGROUND
[0002] Mahjong game belongs to an incomplete information game, and due to its huge hidden information (such as the opponent's hand and the cards on the wall), it is difficult to accurately judge the current situation and affect the decision-making of the self, and the traditional method is difficult to be directly applied to mahjong game decision-making.
[0003] In China, the construction of an intelligent mahjong decision-making model is mainly realized by a knowledge-based method, which summarizes the game knowledge of human players into rules, and calculates the best decision-making by combining the evaluation or search method.
[0004] However, the intelligent game decision-making developed at home and abroad needs to use the traditional machine learning algorithm, which needs to collect a large amount of data of the user in the mahjong platform to train the mahjong intelligent decision-making model, but for the mahjong game platform which has been operated for a short time, due to the small amount of users, there is a lack of massive data of the battle, especially the data of the battle of high-level players to optimize the decision-making model, which leads to a long intelligent decision-making time of the existing mahjong game platform and poor user experience. SUMMARY
[0005] Therefore, the purpose of the present application is to provide an intelligent decision-making method and system based on a card drawing mode, a storage medium and a computer device to solve at least one of the above problems.
[0006] The intelligent decision-making method based on the card drawing mode provided by the present application is applied to a computer device, and the method comprises the following steps:
[0007] Obtaining mahjong winning rules, and analyzing current hand information according to the mahjong winning rules to obtain a pair of card combination, a pair of card combination and a waste card set;
[0008] Recursively expanding the effective card required by the pair of card and the pair of card as a card drawing node to establish a winning card combination tree;
[0009] Traversing the winning card combination tree to obtain a plurality of winning card paths corresponding to the current hand information, and recording the discarding information corresponding to each winning card path, wherein the waste card set comprises the discarding information;
[0010] Obtaining the card drawing information corresponding to each node under each winning card path respectively, and calculating the card drawing probability and the card drawing weight of the card drawing information corresponding to each node;
[0011] Obtain the winning score of each winning path, and comprehensively calculate the expected value of the playing information based on the winning score of each winning path, the probability of drawing cards and the weight of drawing cards corresponding to each node under each winning path, and select the playing information corresponding to the maximum expected value to make a playing decision.
[0012] In summary, the intelligent decision-making method based on the draw mode reduces the search depth by half by retaining only the heuristic information search method for the draw, greatly improving the computational speed of the playing decision. Specifically, the winning rules of Mahjong are first obtained, and the acquired hand information is analyzed according to the winning rules to obtain the pair and pair combinations. Only the valid cards required for the pair and pair are used as draw nodes to quickly expand multiple winning paths. The playing information corresponding to each winning path is recorded. This playing information is all drawn from the waste card set. The draw probability and draw weight of the draw information corresponding to each winning path are then obtained. The expected value of the playing information is calculated based on the winning score of each winning path and the draw probability and draw weight of the draw information corresponding to each node in each winning path to determine the playing decision. This method does not require a large amount of computing resources and has a more obvious advantage in response speed. At the same time, the draw probability and winning score are comprehensively evaluated, which has the advantages of fast winning and high score.
[0013] Furthermore, the steps of obtaining mahjong winning rules and analyzing current hand information according to the mahjong winning rules to obtain a pair card combination, a pair card combination, and a waste card set include:
[0014] Obtaining hand information, and splitting and combining the hand information to obtain multiple hand combinations, the hand combinations including all possible combinations of pung, straight, pair, pair, and useless cards;
[0015] Obtain the corresponding number of xiangting for each hand combination, and obtain the current total score of each hand combination according to a preset score table, wherein the preset score table is composed of the scores corresponding to the pung combination, the straight combination, the pair combination, the pair combination, and various combinations;
[0016] The combination score corresponding to each hand combination is calculated according to the preset weight ratio corresponding to the number of listening points and the total number of points, and the hand combination corresponding to the highest combination score is selected as the target hand combination, and the target hand combination is analyzed according to the mahjong winning rules.
[0017] Furthermore, the calculation formula for the probability of drawing a card is:
[0018]
[0019] Among them, Mo valueirepresents the probability of drawing the i-th card under the winning path, N i Indicates the number of remaining cards corresponding to the information before the i-th card is drawn, realmain num Indicates the total number of remaining cards;
[0020] The calculation formula for the total number of remaining cards is:
[0021] remain num =134-N discards -N op -N handscards
[0022] Among them, reamain num Indicates the total number of remaining cards, N discards It is expressed as the total number of cards played by four players, N op Indicates the number of cards included in the four players' side shows, N handscards The number of cards in your hand.
[0023] Furthermore, the calculation formula for the card weight of the card information under the winning path is:
[0024]
[0025] Among them, taking value Indicates the weight value of the card information under the winning path, Mo valuei Indicates the probability of drawing the i-th card under the winning path, taking weighti Indicates the weight of obtaining the i-th card information, award i Indicates the reward corresponding to the i-th card draw information;
[0026] The calculation formula for the reward corresponding to the i-th card draw information is:
[0027]
[0028] Among them, the value of i is 1 to 9, representing the card value of Wan, Tiao, and Tong, and a1, a2, and a3 represent the rewards corresponding to different card values;
[0029] The calculation formula for the acquisition weight of the card information is:
[0030] taking weight =2+G1+G2+G3+bias
[0031] Among them, Gz represents the probability of obtaining the valid card from player z, which is recorded as 2 if it can be obtained and 0 if it cannot be obtained, where z∈{1,2,3}, and bais represents the calibration deviation value.
[0032] Furthermore, the calculation formula for the winning score is:
[0033] Path value =taking value ×fan score
[0034] Among them, Path value Indicates the winning score corresponding to the winning path, taking value Indicates the weight of the card information under the winning path, fan score Indicates the total score of all the card types included in the winning path;
[0035] The formula for calculating the total score of all card types included in the winning path is:
[0036]
[0037] Among them, fan score Indicates the total score of all the card types included in the winning path, fan score It represents the fan score corresponding to the i-th hand type in the winning path.
[0038] Furthermore, the calculation formula for the expected value of the playing card information is:
[0039]
[0040] Among them, discard value Indicates the expected value of the card information, Path valuei Indicates the winning score corresponding to the i-th card drawn in the winning path;
[0041] Filtering the maximum expected value from all expected values corresponding to the playing information as the target expected value, and using the playing information corresponding to the target expected value as the best playing card, so as to make a playing decision based on the best playing card;
[0042] The calculation formula for obtaining the target expected value is:
[0043] Optiaml discard =max(discards value )
[0044] Among them, Optiaml discard Indicates the target expected value, discard value Indicates the expected value of the card playing information.
[0045] Further, the described effective board required for described pair board and described pair board is carried out recursively expansion as drawing board node, and the step of setting up winning card combination tree also comprises:
[0046] Select the pair combination and the pair combination in turn, and add the valid cards corresponding to the pair combination and the pair combination to the draw card set;
[0047] If both the pair combination and the pair combination are empty, select from the remaining cards one by one, and add the adjacent cards corresponding to the selected remaining cards to the draw set to obtain the final draw set, and construct a winning combination tree based on the final draw set.
[0048] An intelligent decision-making system based on a card-drawing mode according to an embodiment of the present invention is applied to a computer device. The intelligent decision-making system based on a card-drawing mode includes:
[0049] A hand analysis module is used to obtain mahjong winning rules and analyze the current hand information according to the mahjong winning rules to obtain a pair card combination, a pair card combination and a waste card set;
[0050] A card drawing expansion module is used for recursively expanding the card drawing nodes using the valid cards required for the pair cards and the pair cards to establish a winning combination tree;
[0051] a playing card information acquisition module, configured to traverse the winning card combination tree to acquire a plurality of winning card paths corresponding to the current hand information, and record playing card information corresponding to each winning card path, wherein the discarded card set includes the playing card information;
[0052] The card drawing information analysis module is used to obtain the card drawing information corresponding to each node under each winning path, and calculate the card drawing probability and card drawing weight of the card drawing information corresponding to each node;
[0053] The card-playing decision module is used to obtain the winning score of each winning path, and comprehensively calculate the expected value of the card-playing information based on the winning score of each winning path, the card-drawing probability and card-drawing weight of the card-drawing information corresponding to each node under each winning path, and select the card-playing information corresponding to the maximum expected value to make a card-playing decision.
[0054] On the other hand, the present invention also provides a storage medium, which stores one or more programs, and when the programs are executed, implement the above-mentioned intelligent decision-making method based on the card-drawing mode.
[0055] Another aspect of the present invention provides a computer device, comprising a memory and a processor, wherein:
[0056] The memory is used to store computer programs;
[0057] When the processor is used to execute the computer program stored in the memory, it implements the above-mentioned intelligent decision-making method based on the card-drawing mode.
[0058] Additional aspects and advantages of the present invention will be set forth in part in the following description and, in part, will be obvious from the following description, or may be learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 This is a flow chart of the intelligent decision-making method based on the card-drawing mode proposed in the first embodiment of the present invention;
[0060] Figure 2 1 is an example diagram of a winning combination tree in the first embodiment of the present invention;
[0061] Figure 3 This is a flow chart of the intelligent decision-making method based on the card-drawing mode proposed in the second embodiment of the present invention;
[0062] Figure 4 This is a schematic diagram of the structure of the intelligent decision-making system based on the card-drawing mode proposed in the third embodiment of the present invention.
[0063] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0064] To facilitate understanding of the present invention, the present invention will be described more fully below with reference to the accompanying drawings. The drawings illustrate several embodiments of the present invention. However, the present invention may be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and comprehensive understanding of the present invention.
[0065] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be an intermediate element. When an element is referred to as being "connected to" another element, it may be directly connected to the other element or there may be an intermediate element. The terms "vertical," "horizontal," "left," "right," and similar expressions used herein are for illustrative purposes only.
[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this invention pertains. The terms used in this specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0067] See also Figure 1 , which is a flow chart of the intelligent decision-making method based on the card-drawing mode of the present invention, applied to a computer device, the method includes steps S01 to S05, wherein:
[0068] Step S01: Obtaining mahjong winning rules, and analyzing current hand information according to the mahjong winning rules to obtain a pair card combination, a pair card combination, and a waste card set;
[0069] It should be noted that due to cultural differences in various regions, each place has its own independent way of playing mahjong. Based on this, it is first necessary to obtain the winning rules corresponding to the new mahjong operating platform in the region. Under the mahjong winning rules, the computer equipment conducts targeted analysis on the obtained hand information to obtain the combination of consecutive cards (AAA type), straight card combination (ABC type), pair card combination (AB type), and pair card combination (AA type). Other single cards that cannot participate in the combination are uniformly classified into the waste card collection.
[0070] Step S02: recursively expanding the valid tiles required for the pair tiles and the pair tiles as the tiles-drawing nodes to establish a winning combination tree;
[0071] It should be noted that in the game of Mahjong, the sole objective is to win. Therefore, when expanding, the computer device only needs to know which cards are needed for the current hand to win, and then expand the valid cards involved. The valid cards are the required cards. When the hand information meets the winning conditions, the number of cards is greater than 14. The cards that are not involved in the winning combination are placed in the waste card collection. The cards in the waste card collection are set as the highest priority playing order. The pairs and pairs are set as the second-level useful cards and serve as the secondary playing order. The chopped pieces and straights are set as the first-level useful cards and serve as the lowest playing order. This allows the winning objective to be considered while also taking into account the playing strategy in the Mahjong game. Then, by evaluating the path, the optimal playing order can be determined, specifically:
[0072] See also Figure 2 , shown is an example diagram of the winning combination number constructed in this embodiment, Figure 2 The winning combination tree on the left is a search scheme that takes into account both drawing cards and playing cards. This scheme involves more tree nodes and the search work is more complicated, resulting in the need for a lot of computing resources and computing time. Based on this, this embodiment adopts Figure 2 The search method on the right is a new search method that only uses a card-drawing search strategy. The number of layers in the search tree is reduced by half, the complexity of the search tree is reduced accordingly, and the number of corresponding state nodes decreases exponentially.
[0073] Specifically, if Figure 2The right combination tree shows that, in the case of hand information 【1 million, 2 million, 4 million, 8 million, 8 million】, based on hand analysis, 12 pairs of combination, 24 pairs of combination, and 88 pairs of combination are obtained. Since 12 pairs of combination and 24 pairs of combination have the same hand, the same hand needs to be merged and removed, and 124 pairs of combination and 88 pairs of combination are obtained, so that the valid cards corresponding to the current hand information are 3 million and 8 million. In the case of valid card 8 million, further expansion is performed to obtain three card drawing modes of 1 million, 2 million, and 4 million. Such expansion is continuously performed until the last expansion to the winning mode is stopped, so that the final corresponding various card information under each winning path is obtained.
[0074] Step S03: traversing the winning combination tree to obtain a plurality of winning paths corresponding to the current hand information, and recording the card information corresponding to each winning path, wherein the discard set includes the card information;
[0075] It should be noted that the expansion of the winning combination number of each card drawing node is performed according to the valid card corresponding to the pair and the pair in the hand information, so as to reduce the number of listening to the number until the winning card is drawn. The expansion is not a random expansion. In the expansion process, all winning possibilities are traversed, and invalid card drawing can be pruned.
[0076] Further, based on the winning combination tree constructed only considering the card drawing mode, the card information corresponding to each winning path under the winning combination tree corresponds to one or more cards in the discard set, so as to ensure the best card playing strategy.
[0077] Step S04: obtaining the card drawing information corresponding to each node under each winning path, and calculating the card drawing probability and card drawing weight of the card drawing information corresponding to each node;
[0078] In this step, the calculation formula of the card drawing probability is:
[0079]
[0080] wherein, Mo valuei represents the card drawing probability of the i-th card drawing information under the winning path, N i represents the remaining number of cards corresponding to the card drawing information before the i-th card drawing, remain num represents the total remaining number of cards;
[0081] The calculation formula of the total remaining number of cards is:
[0082] remain num = 134-N discards -N op -N handscards
[0083] Among them, reamain num Indicates the total number of remaining cards, N discards It is expressed as the total number of cards played by four players, N op Indicates the number of cards included in the four players' side shows, N handscards The number of cards in your hand;
[0084] It should also be noted that the probability of drawing a card is calculated by dividing the number of remaining cards drawn based on the information available from the current player's perspective by the total number of remaining cards. i It may be included in the opponent's hand. This is also the information that can be obtained by simulating real players. The calculation formula for the number of remaining cards corresponding to the card information is:
[0085] N i =4-n1-n2-n3
[0086] Where n1 is the number of Ni cards in the discards of the four players, and n2 is the number of N cards in the secondary cards of the four players. i The number of cards in your hand, n3 contains N i The number of sheets.
[0087] Furthermore, the calculation formula for the card weight of the card information under the winning path is:
[0088]
[0089] Among them, taking value Indicates the weight value of the card information under the winning path, Mo valuei Indicates the probability of drawing the i-th card under the winning path, taking weighti Indicates the weight of obtaining the i-th card information, award i Indicates the reward corresponding to the i-th card draw information;
[0090] It should be noted that the weight of obtaining each tile information is assigned different values according to different combinations. For example, different weights are required for each tile to turn into a clef, a pair to turn into a straight, and a lone tile to expand and determine a general. At the same time, in actual mahjong gameplay, the reward value corresponding to each tile will also be different. For example, the reward value of 19,000 is different from the reward value of 37,000. Based on this, the calculation formula for the reward corresponding to the i-th tile information is:
[0091]
[0092] Among them, the value of i is 1 to 9, representing the card value of Wan, Tiao, and Tong, and a1, a2, and a3 represent the rewards corresponding to different card values;
[0093] The calculation formula for the acquisition weight of the card information is:
[0094] taking weight =2+G1+G2+G3+bias
[0095] Among them, Gz represents the probability of obtaining the valid card from player z, which is recorded as 2 if it can be obtained and 0 if it cannot be obtained, where z∈{1,2,3}, and bais represents the calibration deviation value.
[0096] Step S05: Obtain the winning score of each winning path, and comprehensively calculate the expected value of the playing information based on the winning score of each winning path, the probability of drawing cards and the weight of drawing cards corresponding to each node under each winning path, and select the playing information corresponding to the maximum expected value to make a playing decision.
[0097] It should be noted that in this embodiment, based on the search of all card types, the fan type score of each search path needs to be calculated. Each winning path may have overlapping scoring card types, so all card types need to be searched and calculated. For example, a seven-pair may include a pure suit and a dragon. Therefore, when calculating the winning score, all card types included in the winning path need to be taken into account. The calculation formula for the winning score is:
[0098] Path value =taking value ×fan score
[0099] Among them, Path value Indicates the winning score corresponding to the winning path, taking value Indicates the weight of the card information under the winning path, fan score Indicates the total score of all the card types included in the winning path;
[0100] The formula for calculating the total score of all card types included in the winning path is:
[0101]
[0102] Among them, fan score Indicates the total score of all the card types included in the winning path, fan score It represents the fan score corresponding to the i-th hand type in the winning path.
[0103] The calculation formula of the expected value of the playing card information is:
[0104]
[0105] Among them, discard value Indicates the expected value of the card information, Pathvaluei Indicates the winning score corresponding to the i-th card drawn in the winning path;
[0106] Before making the final decision on playing a card, it is necessary to filter out the maximum expected value from all the expected values corresponding to the playing information as the target expected value, and use the playing information corresponding to the target expected value as the best playing card, so as to make the playing decision based on the best playing card. The calculation formula for obtaining the target expected value is:
[0107] Optiaml discard =max(discards value )
[0108] Among them, Optiaml discard Indicates the target expected value, discard value Indicates the expected value of the card playing information.
[0109] In summary, the intelligent decision-making method based on the draw mode reduces the search depth by half by retaining only the heuristic information search method for the draw, greatly improving the computational speed of the playing decision. Specifically, the winning rules of Mahjong are first obtained, and the acquired hand information is analyzed according to the winning rules to obtain the pair and pair combinations. Only the valid cards required for the pair and pair are used as draw nodes to quickly expand multiple winning paths. The playing information corresponding to each winning path is recorded. This playing information is all drawn from the waste card set. The draw probability and draw weight of the draw information corresponding to each winning path are then obtained. The expected value of the playing information is calculated based on the winning score of each winning path and the draw probability and draw weight of the draw information corresponding to each node in each winning path to determine the playing decision. This method does not require a large amount of computing resources and has a more obvious advantage in response speed. At the same time, the draw probability and winning score are comprehensively evaluated, which has the advantages of fast winning and high score.
[0110] See also Figure 3 , which shows an intelligent decision-making method based on a card-drawing mode in a second embodiment of the present invention, applied to a computer device, and includes steps S11 to S18, wherein:
[0111] Step S11: obtaining hand information, and splitting and combining the hand information to obtain multiple hand combinations, wherein the hand combinations include all possible combinations of pung, straight, pair, pair, and useless cards;
[0112] As you can understand, a pung is a combination of three identical tiles, such as (4w, 4w, 4w); a straight is a combination of three tiles with increasing numbers, such as (3w, 4w, 5w); a pair is two identical tiles, such as (4w, 4w); a pair includes AB and AC types, representing a combination of two tiles with consecutive numbers or one tile in between; a xiangting number is the minimum number of tiles missing from a winning hand. The basic elements of a winning hand are composed of face tiles and pair tiles. The combination information expanded by computer equipment is as follows:
[0113] Combination 1: [[[1 set of 1 doubles], [1 set of 1 straights], [1 set of 1 pair], [1 set of 1 straights], [1 set of 1 straights], [1 remaining card]]
[0114] Combination 2: [[Pung set 2], [Straight set 2], [Pair set 2], [Towards 2], [Remaining cards 2]],
[0115] …
[0116] Combination n: [[set of punks n], [set of straights n], [set of pairs n], [number of cards to be drawn n], [remaining cards n]]].
[0117] Step S12: Obtain the corresponding number of xiangting for each hand combination, and obtain the current total score of each hand combination according to a preset score table, wherein the preset score table includes scores corresponding to pung combinations, straight combinations, pair combinations, and pairs;
[0118] It should be noted that although the ultimate goal of a mahjong game is to win, since a gong combination is generally less likely to be obtained than a straight combination, a hand with more gongs or pairs generally has a higher winning score than a hand with more straights. Therefore, when the computer device splits and combines the opponent's tiles, it is necessary not only to minimize the number of pings but also to ensure a higher winning score. Therefore, in this embodiment, a preset score table is pre-created and stored in the computer device. This preset score table includes the scores corresponding to gong combinations, straight combinations, pair combinations, and various other combinations. Generally, the scores are ranked from highest to lowest: gong combinations, straight combinations, pair combinations, and pair combinations.
[0119] Step S13: Calculate the combination score corresponding to each hand combination according to the preset weight ratio corresponding to the number of listening points and the total number of points, and select the hand combination corresponding to the highest combination score as the target hand combination, and analyze the target hand combination according to the mahjong winning rules.
[0120] In this step, the computer device considers the winning number and the possible winning points of various combinations in the process of selecting the hand combination, so as to obtain the combination score of all hand combinations involved in the splitting and combination of the hand information, and then select the hand combination corresponding to the highest combination score as the target hand combination, that is, complete the analysis of the hand information.
[0121] Specifically, since the mahjong winning rules of various regions are different, and the combination points are closely related to the mahjong winning rules, the mahjong platform maintainer can create a preset point table according to the specific use, so the preset point table and the preset weight are not limited in detail in this embodiment.
[0122] Step S14: Select the pair combination and the pair combination in turn, and add the effective card corresponding to the pair combination and the pair combination to the card set;
[0123] Step S15: If the pair combination and the pair combination are empty, select the remaining card in turn, add the adjacent card corresponding to the selected remaining card to the card set, obtain the final card set, and construct the winning combination tree according to the final card set.
[0124] It should be noted that in the process of constructing the winning combination tree, only the card drawing mode is considered, and the card drawing information corresponding to each card drawing node of the winning combination tree is obtained from the card set. All effective cards in the card set are generally composed of the missing cards of the pair combination or the pair combination. If there is no pair combination or pair combination in the target hand combination, it means that there are a large number of isolated cards in the current hand information. At this time, the adjacent card corresponding to each isolated card needs to be added to the card set to obtain the final card set, which provides the possibility for constructing the winning combination tree. It should be noted that the adjacent card corresponding to the isolated card B includes the A card, the B card and the C card, that is, the same isolated card is also regarded as the adjacent card.
[0125] Step S16: Traverse the winning combination tree to obtain a plurality of winning paths corresponding to the current hand information, and record the discarding information corresponding to each winning path, wherein the discarding set includes the discarding information;
[0126] Step S17: Obtain the card drawing information corresponding to each node under each winning path, and calculate the card drawing probability and card drawing weight of the card drawing information corresponding to each node;
[0127] Step S18: Obtain the winning score of each winning path, and comprehensively calculate the expected value of the playing information based on the winning score of each winning path, the probability of drawing cards and the weight of drawing cards corresponding to each node under each winning path, and select the playing information corresponding to the maximum expected value to make a playing decision.
[0128] Compared with the existing technology, the intelligent decision-making method based on the card-drawing mode proposed in this embodiment has the following advantages:
[0129] (1) This scheme adopts a heuristic information search mode that only retains the cards that have been touched, which reduces the search depth by half. At the same time, the winning combination tree constructed according to the specific rules of the mahjong game can remove a large number of invalid search paths, reduce the complexity of the search tree, and improve the accuracy of the search. At the same time, the computing resources consumed will be greatly reduced, which has a more obvious advantage in the response speed of playing cards.
[0130] (2) This solution is a heuristic information search based on the card-drawing mode. It does not require a large amount of high-level player user data for training, nor does it require a large amount of resources and time to train the model. It can complete a set of mahjong intelligent decision-making systems in a relatively short period of time and achieve a high level of decision-making. For mahjong games that have just been launched by game companies, even if there is not enough user data, this solution can also obtain a high-level mahjong intelligent decision-making system, which has better universality.
[0131] (3) This scheme comprehensively evaluates the opponent's card information in terms of the probability of drawing cards, the weight of drawing cards, and the winning score. It can obtain more winning scores while having a higher winning rate.
[0132] See also Figure 3 , shown is an intelligent decision-making system based on a card-drawing mode in a third embodiment of the present invention, applied to a computer device, the system comprising:
[0133] The hand analysis module 10 is used to obtain mahjong winning rules and analyze the current hand information according to the mahjong winning rules to obtain the pair card combination, the pair card combination and the waste card set;
[0134] Furthermore, the hand analysis module 10 further includes:
[0135] a splitting and combining unit for acquiring hand information, and splitting and combining the hand information to obtain a plurality of hand combinations, wherein the hand combinations include all possible combinations of pung, straight, pair, pair, and useless cards;
[0136] a hand combination evaluation unit for obtaining the corresponding number of draws for each hand combination and obtaining the current total score of each hand combination according to a preset score table, wherein the preset score table includes scores corresponding to pung combinations, straight combinations, pair combinations, and pairs;
[0137] The target hand acquisition unit is used to calculate the combination score corresponding to each hand combination according to the preset weight ratio corresponding to the number of listening points and the total number of points, and select the hand combination corresponding to the highest combination score as the target hand combination, and analyze the target hand combination according to the mahjong winning rules.
[0138] A card drawing expansion module 20 is used for recursively expanding the card drawing nodes using the valid cards required for the pair cards and the pair cards to establish a winning combination tree;
[0139] Furthermore, the card drawing expansion module 20 further includes:
[0140] The first selection unit is used to select a pair combination and a pair combination in sequence, and add the valid cards corresponding to the pair combination and the pair combination to the card collection;
[0141] The second selection unit is used to select from the remaining cards one by one if both the pair combination and the pair combination are empty, and add the adjacent cards corresponding to the selected remaining cards to the card drawing set to obtain the final card drawing set, and construct a winning combination tree based on the final card drawing set.
[0142] a playing card information acquisition module 30 for traversing the winning card combination tree to obtain a plurality of winning card paths corresponding to the current hand information, and recording playing card information corresponding to each winning card path, wherein the discarded card set includes the playing card information;
[0143] The card drawing information analysis module 40 is used to obtain the card drawing information corresponding to each node under each winning path, and calculate the card drawing probability and card drawing weight of the card drawing information corresponding to each node;
[0144] The card-playing decision module 50 is used to obtain the winning score of each winning path, and comprehensively calculate the expected value of the card-playing information based on the winning score of each winning path, the card-drawing probability and card-drawing weight of the card-drawing information corresponding to each node under each winning path, and select the card-playing information corresponding to the maximum expected value to make a card-playing decision.
[0145] Furthermore, in some optional embodiments, the calculation formula for the probability of drawing a card is:
[0146]
[0147] Among them, Mo valuei represents the probability of drawing the i-th card under the winning path, Ni Indicates the number of remaining cards corresponding to the information before the i-th card is drawn, realmain num Indicates the total number of remaining cards;
[0148] The calculation formula for the total number of remaining cards is:
[0149] remain num =134-N discards -N op -N handscards
[0150] Among them, reamain num Indicates the total number of remaining cards, N discards It is expressed as the total number of cards played by four players, N op Indicates the number of cards included in the four players' side shows, N handscards The number of cards in your hand.
[0151] Furthermore, in some optional embodiments, the calculation formula for the card-drawing weight of the card-drawing information in the winning path is:
[0152]
[0153] Among them, taking value Indicates the weight value of the card information under the winning path, Mo valuei Indicates the probability of drawing the i-th card under the winning path, taking weighti Indicates the weight of obtaining the i-th card information, award i Indicates the reward corresponding to the i-th card draw information;
[0154] The calculation formula for the reward corresponding to the i-th card draw information is:
[0155]
[0156] Among them, the value of i is 1 to 9, representing the card value of Wan, Tiao, and Tong, and a1, a2, and a3 represent the rewards corresponding to different card values;
[0157] The calculation formula for the acquisition weight of the card information is:
[0158] taking weight =2+G1+G2+G3+bias
[0159] Among them, Gz represents the probability of obtaining the valid card from player z, which is recorded as 2 if it can be obtained and 0 if it cannot be obtained, where z∈{1,2,3}, and bais represents the calibration deviation value.
[0160] Further, in some optional embodiments, the calculation formula of the winning hand score is:
[0161] Path value = taking value x fan score
[0162] wherein Path value represents the winning hand score corresponding to the winning hand path, taking value represents the tile drawing weight value of the tile drawing information under the winning hand path, and fan score represents the total sum of all tile pattern scores contained in the winning hand path.
[0163] The calculation formula of the total sum of all tile pattern scores contained in the winning hand path is:
[0164]
[0165] wherein fan score represents the total sum of all tile pattern scores contained in the winning hand path, and fan score represents the winning hand score corresponding to the i-th tile pattern under the winning hand path.
[0166] Further, in some optional embodiments, the calculation formula of the expected value of the discarding information is:
[0167]
[0168] wherein discard value represents the expected value of the discarding information, Path valuei represents the winning hand score corresponding to the i-th tile drawing information under the winning hand path.
[0169] The maximum expected value is selected from all expected values of the discarding information as a target expected value, and the discarding information corresponding to the target expected value is regarded as the optimal discarding, so as to make a discarding decision according to the optimal discarding.
[0170] The calculation formula of the target expected value is:
[0171] Optiaml discard = max(discards value )
[0172] wherein Optiaml discard represents the target expected value, and discard value represents the expected value of the discarding information.
[0173] In summary, the intelligent decision-making system based on the draw mode reduces the search depth by half by retaining only the heuristic information search method for draw cards, greatly improving the computational speed of playing decisions. Specifically, the system first obtains the mahjong winning rules and analyzes the acquired hand information according to the winning rules to obtain the pair and pair combinations. Only the valid cards required for the pair and pair are used as draw nodes to quickly expand multiple winning paths. The playing information corresponding to each winning path is recorded. This playing information is all drawn from a set of discarded cards. The draw probability and draw weight of the draw information corresponding to each winning path are then obtained. The expected value of the playing information is calculated based on the winning score of each winning path and the draw probability and draw weight of the draw information corresponding to each node in each winning path to determine the playing decision. This system does not require a large amount of computing resources and has a more obvious advantage in response speed. The system also comprehensively evaluates the draw probability and winning score, achieving the advantages of fast winning and high score.
[0174] On the other hand, the present invention further proposes a computer storage medium on which one or more programs are stored, which, when executed by a processor, implement the above-mentioned intelligent decision-making method based on the card-drawing mode.
[0175] On the other hand, the present invention also proposes a computer device, wherein the computer device can be but is not limited to a mahjong machine, a computer, a mobile phone, or other electronic device capable of playing a virtual mahjong game, and the computer device includes a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the above-mentioned intelligent decision-making method based on the card-drawing mode.
[0176] Those skilled in the art will appreciate that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device), or in conjunction with such instruction execution system, apparatus, or device. For purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device.
[0177] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.
[0178] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0179] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0180] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
Claims
1. An intelligent decision-making method based on a card-drawing mode, characterized in that: Applied to a computer device, the method comprises: Obtaining mahjong winning rules, and analyzing current hand information according to the mahjong winning rules to obtain a pair card combination, a pair card combination, and a waste card set, wherein the waste card set includes single cards that cannot participate in a combination; Recursively expanding the effective tiles required for the pair tiles and the pair tiles as the tiles-drawing nodes to establish a winning combination tree; Traversing the winning combination tree to obtain multiple winning paths corresponding to the current hand information, and recording the playing card information corresponding to each winning path, wherein the discarded card set includes the playing card information; Get the card information corresponding to each node under each winning path respectively, and calculate the probability and weight of the card information corresponding to each node. The calculation formula of the card weight of the card information under the winning path is: in, Indicates the weight value of the card drawing information under the winning path, Indicates the winning path The probability of drawing a card with the information of the card being drawn, Indicates the The weight of obtaining the card information, Indicates the The reward corresponding to the card drawing information; Obtain the winning score of each winning path, and calculate the expected value of the playing information based on the winning score of each winning path, the probability of drawing cards and the weight of drawing cards corresponding to each node under each winning path, and select the playing information corresponding to the maximum expected value for playing card decision. The calculation formula of the winning score is: in, Indicates the winning score corresponding to the winning path, It represents the total score of all the card types included in the winning path. The formula for calculating the total score of all card types included in the winning path is: in, Indicates the winning path The fan score corresponding to the middle card type, The calculation formula of the expected value of the playing card information is: in, Indicates the expected value of the card information. Indicates the winning path. The winning score corresponding to the card information is: The maximum expected value is selected from the expected values corresponding to all the playing information as the target expected value, and the playing information corresponding to the target expected value is used as the best playing card, so as to make a playing card decision based on the best playing card. The calculation formula for obtaining the target expected value is: in, Indicates the target expected value.
2. The intelligent decision-making method based on the card-drawing mode according to claim 1, characterized in that: The steps of obtaining mahjong winning rules and analyzing current hand information according to the mahjong winning rules to obtain a pair card combination, a pair card combination, and a waste card set include: Obtaining hand information, and splitting and combining the hand information to obtain multiple hand combinations, the hand combinations including all possible combinations of pung, straight, pair, pair, and useless cards; Obtain the corresponding number of xiangting for each hand combination, and obtain the current total score of each hand combination according to a preset score table, wherein the preset score table is composed of the scores corresponding to the pung combination, the straight combination, the pair combination, the pair combination, and various combinations; The combination score corresponding to each hand combination is calculated according to the preset weight ratio corresponding to the number of listening points and the total number of points, and the hand combination corresponding to the highest combination score is selected as the target hand combination, and the target hand combination is analyzed according to the mahjong winning rules.
3. The intelligent decision-making method based on the card-drawing mode according to claim 1 is characterized in that: The calculation formula for the probability of drawing a card is: in, Indicates the winning path The probability of drawing a card with the information of the card being drawn, Indicates the The number of remaining cards corresponding to the card information before Zhang draws the card, Indicates the total number of remaining cards; The calculation formula for the total number of remaining cards is: in, It is expressed as the total number of cards played by the four players. Indicates the number of cards included in the four players' side shows. The number of cards in your hand.
4. The intelligent decision-making method based on the card-drawing mode according to claim 3 is characterized in that: The calculation formula for the reward corresponding to the i-th card draw information is: in, The value of is 1~9, which means the value of Wan, Tiao and Tong. 、 、 Respectively represent the rewards corresponding to different card values; The calculation formula for the acquisition weight of the card information is: Where Gz represents the probability of obtaining the valid card from player z, which is 2 if it is obtained and 0 if it is not obtained, where z∈{1,2,3}, Indicates the calibration offset value.
5. The intelligent decision-making method based on the card-drawing mode according to claim 2 is characterized in that: The described effective board required for described pair board and described pair board is carried out recursively expansion as drawing board node, and the step of setting up winning card combination tree also comprises: Select the pair combination and the pair combination in turn, and add the valid cards corresponding to the pair combination and the pair combination to the draw card set; If both the pair combination and the pair combination are empty, select from the remaining cards one by one, and add the adjacent cards corresponding to the selected remaining cards to the draw set to obtain the final draw set, and construct a winning combination tree based on the final draw set.
6. An intelligent decision-making system based on the card-drawing mode, characterized in that: Applied to a computer device, for implementing the intelligent decision-making method based on the card-drawing mode according to any one of claims 1 to 5, the intelligent decision-making system based on the card-drawing mode comprising: A hand analysis module is used to obtain mahjong winning rules and analyze the current hand information according to the mahjong winning rules to obtain a pair card combination, a pair card combination and a waste card set; A card drawing expansion module is used for recursively expanding the card drawing nodes using the valid cards required for the pair cards and the pair cards to establish a winning combination tree; a playing card information acquisition module, configured to traverse the winning card combination tree to acquire a plurality of winning card paths corresponding to the current hand information, and record playing card information corresponding to each winning card path, wherein the discarded card set includes the playing card information; The card drawing information analysis module is used to obtain the card drawing information corresponding to each node under each winning path, and calculate the card drawing probability and card drawing weight of the card drawing information corresponding to each node; The card-playing decision module is used to obtain the winning score of each winning path, and comprehensively calculate the expected value of the card-playing information based on the winning score of each winning path, the card-drawing probability and card-drawing weight of the card-drawing information corresponding to each node under each winning path, and select the card-playing information corresponding to the maximum expected value to make a card-playing decision.
7. A storage medium, characterized in that: The storage medium stores one or more programs, which, when executed by the processor, implement the intelligent decision-making method based on the card-drawing mode as described in any one of claims 1 to 5.
8. A computer device, characterized in that: The computer device comprises a memory and a processor, wherein: The memory is used to store computer programs; When the processor is used to execute the computer program stored in the memory, it implements the intelligent decision-making method based on the card-drawing mode described in any one of claims 1-5.
Citation Information
Patent Citations
Game service execution method and device based on artificial intelligence, equipment and medium
CN110826717A
Data processing method and device, electronic device and storage medium
CN111265878A