CN113058271A - Game control method, device, server and storage medium - Google Patents

Game control method, device, server and storage medium Download PDF

Info

Publication number
CN113058271A
CN113058271A CN202110254202.9A CN202110254202A CN113058271A CN 113058271 A CN113058271 A CN 113058271A CN 202110254202 A CN202110254202 A CN 202110254202A CN 113058271 A CN113058271 A CN 113058271A
Authority
CN
China
Prior art keywords
value
card
array
hand
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110254202.9A
Other languages
Chinese (zh)
Other versions
CN113058271B (en
Inventor
田军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110254202.9A priority Critical patent/CN113058271B/en
Publication of CN113058271A publication Critical patent/CN113058271A/en
Application granted granted Critical
Publication of CN113058271B publication Critical patent/CN113058271B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • A63F13/79Game security or game management aspects involving player-related data, e.g. identities, accounts, preferences or play histories
    • A63F13/798Game security or game management aspects involving player-related data, e.g. identities, accounts, preferences or play histories for assessing skills or for ranking players, e.g. for generating a hall of fame
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/80Special adaptations for executing a specific game genre or game mode
    • A63F13/843Special adaptations for executing a specific game genre or game mode involving concurrently two or more players on the same game device, e.g. requiring the use of a plurality of controllers or of a specific view of game data for each player
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/61Score computation

Abstract

The disclosure relates to a game control method, a game control device, a server, a storage medium and a computer program product. The method comprises the following steps: acquiring a hand card type; generating a card type array of the hand card type according to the card value of each hand in the hand card type; determining a first array element and a second array element associated with the card value index in the card type array, and converting the element value of the first array element into a binary characteristic value according to the element value of the first array element and the element value of the second array element until traversing the binary characteristic value of each array element in the card type array; obtaining a hand card type characteristic value according to the binary characteristic value of each array element; and matching the hand type characteristic value with each victory card type characteristic value, and generating victory prompt information when the victory card type characteristic value matched with the hand type characteristic value exists. By adopting the method, the consumption of the win-lose judgment processing on the memory resource and the processor resource can be reduced.

Description

Game control method, device, server and storage medium
Technical Field
The present disclosure relates to data processing technologies, and in particular, to a game control method, apparatus, server, storage medium, and computer program product.
Background
With the development of network technology, chess and card games such as bridge and mahjong are realized based on the network technology, the online chess and card games of each player are realized through data interaction between a server and a terminal, the online games are realized through the interaction between the terminal and the server of the player, and the progress of the games is controlled by the server. For example, in the case of a game for mahjong, the server controls the operations of dealing, winning or losing determination, and the like.
However, the conventional chess and card game win-loss judgment mode often involves the combination of various designs and colors and card values, so that the win-loss judgment mode is complicated, and a large amount of memory and processor resources are consumed.
Therefore, the conventional chess and card game win-lose judgment mode has the problem of higher consumption of computing resources.
Disclosure of Invention
The present disclosure provides a game control method, device, server, storage medium and computer program product, which at least solve the problem of large computing resource consumption in the conventional win or loss determination method in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a game control method including:
acquiring a hand card type; the hand card type consists of a plurality of hands; the hand has a card value;
generating a card type array of the hand card type according to the card value of each hand in the hand card type; the card type array comprises array elements; the array elements have a card value index and an element value; the card value index and the card value have a corresponding relation; the element numerical value is generated according to the number of the target hand; the card value of the target hand is matched with the card value corresponding to the card value index of the array element;
determining a first array element and a second array element associated with the card value index in the card type array, and converting the element value of the first array element into a binary characteristic value according to the element value of the first array element and the element value of the second array element until traversing the binary characteristic value of each array element in the card type array;
obtaining a hand card type characteristic value according to the binary characteristic value of each array element;
and matching the hand type characteristic value with each victory card type characteristic value in a preset victory characteristic value dictionary, and generating victory prompt information when the victory card type characteristic value matched with the hand type characteristic value exists.
According to an exemplary embodiment, the obtaining the hand type characteristic value according to the binary characteristic value of each array element comprises:
combining the binary characteristic values of the array elements according to the brand value indexes of the array elements to obtain characteristic value combination values;
and converting the characteristic value combination value into a hexadecimal characteristic value as the hand type characteristic value.
According to an exemplary embodiment, the binary feature value includes at least a cis sub-feature value and a non-cis sub-feature value, and the converting the element values of the first array elements into the binary feature value according to the element values of the first array elements and the element values of the second array elements includes:
when the element value of the first array element is not zero and the element value of the second array element is zero, converting the element value of the first array element into the non-cis sub-feature value;
and when the element value of the first array element is not zero and the element value of the second array element is not zero, converting the element value of the first array element into the order sub characteristic value.
According to an exemplary embodiment, the generating a card type array of the hand card types according to the card values of the hands in the hand card types comprises:
determining a target element in array elements of the card type array;
determining a target card value index; the target card value index is a card value index of the target element;
searching a hand with the card value matched with the card value corresponding to the target card value index in the hand card type to serve as the target hand;
and counting the number of the target hand as the element value of the target element.
According to an exemplary embodiment, before the obtaining the hand card type, the method further comprises:
acquiring a winning card type; the victory card type is composed of a plurality of the hands;
generating a victory card type array of the victory card types according to the card value of each hand in the victory card types;
determining a third array element and a fourth array element associated with the card value index in the winning card type array, and converting the element value of the third array element into a binary characteristic value according to the element value of the third array element and the element value of the fourth array element until traversing the binary characteristic value of each array element in the winning card type array;
obtaining the characteristic value of the winning brand type according to the binary characteristic value of each array element in the array of the winning brand type;
generating the winning feature value dictionary; the winning feature value dictionary includes the winning hand type feature values.
According to a second aspect of the embodiments of the present disclosure, there is provided a game control apparatus including:
a card type acquisition unit configured to perform acquisition of a hand card type; the hand card type consists of a plurality of hands; the hand has a card value;
an array generating unit configured to execute generating a card type array of the hand card types according to the card values of the hands in the hand card types; the card type array comprises array elements; the array elements have a card value index and an element value; the card value index and the card value have a corresponding relation; the element numerical value is generated according to the number of the target hand; the card value of the target hand is matched with the card value corresponding to the card value index of the array element;
a binary conversion unit configured to execute, in the card type array, determining a first array element and a second array element associated with the card value index, and converting an element value of the first array element into a binary feature value according to the element value of the first array element and the element value of the second array element until traversing the binary feature value of each array element in the card type array;
the characteristic value generating unit is configured to execute binary characteristic values according to the array elements to obtain hand card type characteristic values;
and the winning prompting unit is configured to match the hand type characteristic value with each winning type characteristic value in a preset winning characteristic value dictionary, and generate winning prompting information when the winning type characteristic value matched with the hand type characteristic value exists.
According to an exemplary embodiment, the feature value generation unit is configured to perform:
combining the binary characteristic values of the array elements according to the brand value indexes of the array elements to obtain characteristic value combination values;
and converting the characteristic value combination value into a hexadecimal characteristic value as the hand type characteristic value.
According to an exemplary embodiment, the binary characteristic value comprises at least a cis sub characteristic value and a non-cis sub characteristic value, the binary conversion unit is configured to perform:
when the element value of the first array element is not zero and the element value of the second array element is zero, converting the element value of the first array element into the non-cis sub-feature value;
and when the element value of the first array element is not zero and the element value of the second array element is not zero, converting the element value of the first array element into the order sub characteristic value.
According to an exemplary embodiment, an array generation unit is configured to perform:
determining a target element in array elements of the card type array;
determining a target card value index; the target card value index is a card value index of the target element;
searching a hand with the card value matched with the card value corresponding to the target card value index in the hand card type to serve as the target hand;
and counting the number of the target hand as the element value of the target element.
According to an exemplary embodiment, the apparatus is further configured to perform:
acquiring a winning card type; the victory card type is composed of a plurality of the hands;
generating a victory card type array of the victory card types according to the card value of each hand in the victory card types;
determining a third array element and a fourth array element associated with the card value index in the winning card type array, and converting the element value of the third array element into a binary characteristic value according to the element value of the third array element and the element value of the fourth array element until traversing the binary characteristic value of each array element in the winning card type array;
obtaining the characteristic value of the winning brand type according to the binary characteristic value of each array element in the array of the winning brand type;
generating the winning feature value dictionary; the winning feature value dictionary includes the winning hand type feature values.
According to a third aspect of the embodiments of the present disclosure, there is provided a server, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the game control method as described in the first aspect above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium in which instructions, when executed by a processor of a server, enable the server to implement the game control method as described in the first aspect above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the game control method as described in the above first aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
in the game control method, firstly, a card type array containing attributes such as card value indexes and element numerical values is generated according to the card values of all hands in the hand card type of a user, then, a first array element and a second array element which have incidence relation with the card value indexes are utilized to convert the first array element into binary characteristic values until the binary characteristic values of all array elements are obtained, finally, the hand card type characteristic values are matched with all winning card type characteristic values in a winning characteristic value dictionary according to the binary characteristic values, prompt information is generated during matching, therefore, when the victory or the negativity of a chess game is judged, whether the chess game wins or not can be judged without adopting a complicated victory or negativity judgment mode through single matching of the hand card type characteristic values and the winning card type characteristic values, and the operation amount of the victory or the negativity judgment is reduced, and because the card value index and the card value have a corresponding relation, and the element numerical value records the number of hands with the card value corresponding to the card value index, therefore, the complete hand card type can be recorded through a one-dimensional array with a simpler data structure, and then the array element is converted into a binary characteristic value through a preset conversion rule. Therefore, on the premise of ensuring the accuracy of the win-loss judgment, the consumption of memory resources and processor resources in the win-loss judgment processing is reduced.
Moreover, under the scene that a large number of users play online chess and card games, the efficiency of controlling the victory or defeat judgment by the server is improved, and the users do not need to wait for the victory or defeat judgment processing of the server for a long time.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a diagram illustrating an application environment for a game control method according to an exemplary embodiment.
FIG. 2 is a flow chart illustrating a method of game control according to an exemplary embodiment.
Figure 3 is a flow chart illustrating the conversion steps of a hand style characteristic value according to one exemplary embodiment.
FIG. 4 is a block diagram illustrating a game control device according to an exemplary embodiment.
Fig. 5 is a flow diagram illustrating a win determination according to an exemplary embodiment.
FIG. 6 is a block diagram illustrating a server in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The game control method provided by the present disclosure can be applied to the application environment shown in fig. 1. Wherein the terminal 110 interacts with the server 120 through the network. The terminal 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented by an independent server or a server cluster formed by a plurality of servers. The game user submits a game operation, such as a card touch operation, a winning confirmation operation, and the like, to the server 120 through the terminal 110. The server 120 controls the game progress according to the game operation of the terminal 110, for example, controls the dealing of the cards and the issue of the dealt hand information to the terminal 110, controls the generation of winning prompt information and the issue of the winning prompt information to the terminal 110, and the like.
Fig. 2 is a flowchart illustrating a game control method according to an exemplary embodiment, where the game control method is used in the server 120 as shown in fig. 2, and includes the following steps.
In step S210, a hand card type is acquired; the hand card type consists of a plurality of hands; the hand has a card value.
Where the hand type may be a collection of hands currently held by a game user in a board-like game. For example, for a mahjong game, a hand card type is [ ten thousand, twenty thousand, thirty thousand, forty thousand, seventy thousand, one cylinder, two cylinders, three cylinders, four cylinders, five cylinders, six cylinders ]. For another example, for a bridge game, a hand is of the type [ spade 1, spade 2, square 4, square 5, spade J ].
The card value can be the suit and the value of the hand. For example, for a mahjong game, a hand has a value of seventy thousand, a "ten thousand" suit and a value of "7". For another example, for a bridge game, the value of hand spade K is a "spade" suit and a value of "13".
In particular, the server 120 may perform a card dealing operation such that each user receives multiple hands, forming a hand type.
In step S220, a card type array of the hand card type is generated according to the card value of each of the hands in the hand card type; the card type array comprises array elements; the array elements have a card value index and an element value; the card value index and the card value have a corresponding relation; the element numerical value is generated according to the number of the target hand; the card value of the target hand is matched with the card value corresponding to the card value index of the array element.
The card type array can be a one-dimensional array composed of array elements. Each array element has attributes of a card value index and an element value.
Wherein the card value index may be an ordering of array elements in a card type array, each card value index representing a respective card value. For example, for a mahjong game, the tile value index of the first-ranked array element in the tile type array is "0" representing the tile value of "ten thousand", the tile value index of the second-ranked array element in the tile type array is "1" representing the tile value of "twenty thousand", and so on. In practice, tile value indices "0" through "8" may be used to represent each tile value of a mah-jong suit "ten thousand", tile value indices "9" through "17" may be used to represent each tile value of a mah-jong suit "cylinder", and tile value indices "18" through "26" may be used to represent each tile value of a mah-jong suit "bar".
Wherein the element value may be used to represent the number of hands in the hand type whose hand value matches the hand value corresponding to the hand value index. For example, for an array element having a card value index of "1", which represents the card value of "ten thousand", there are 3 hands having a card value of "ten thousand" in the hand type, and therefore, the element value of the array element is 3.
Specifically, after obtaining the hand card types, the server 120 may convert the hand card types into corresponding card type arrays according to the card values of the hands in the hand card types.
For example, if a hand card type is [ ten thousand, twenty thousand, thirty thousand, forty thousand, seventy thousand, one cylinder, two cylinders, three cylinders, four cylinders, five cylinders, six cylinders ], a one-dimensional card type array [1, 1, 1, 3, 0, 0, 2, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] representing that there are 1 hand with a card value of "one thousand" in the current hand card type, 1 hand with a card value of "two thousand", 1 hand with a card value of "three thousand", and 3 hands with a card value of "four thousand", and so on.
In step S230, in the card type array, a first array element and a second array element associated with the card value index are determined, and according to an element value of the first array element and an element value of the second array element, an element value of the first array element is converted into a binary feature value until the binary feature value of each array element in the card type array is traversed.
The binary characteristic value may be a numerical value represented by binary "0" or "1", for example, 01, 01111, and the like.
Specifically, the server 120 may traverse each array element in the card type array, and convert each array element into a binary numerical value one by one according to a preset conversion rule, as the binary characteristic value.
The conversion rule may be set as: and for the array elements of which the card values corresponding to the card value indexes belong to the same suit, converting the array elements into specific binary characteristic values according to the array elements and the respective element values of the next array elements related to the array elements on the card value indexes.
In practical applications, the association on the card value index may refer to another array element being an array element of the card value index ordered from the current array element, for example, the card value index of the first array element is "5", the card value index of the second array element is "6", and the card value index of the second array element is associated with the card value index of the first array element. The server 120, while traversing each array element in the card type array, may accordingly determine the array element associated with it having a card value index of "6" as the second array element, assuming that the first array element having a card value index of "5" is currently determined.
After determining the first array element and the second array element associated with the card value index, the server 120 converts the first array element into the binary characteristic value according to a preset conversion rule according to the element value of the first array element and the element value of the second array element.
More specifically, the server 120 may convert the first array element into a different binary characteristic value according to whether the respective element values of the first array element and the second array element are zero. For example, when the first array element is not zero and the second array element is also not zero, the first array element may be converted into a binary characteristic value for recording the formation of an order between the first array element and the second array element, and when the first array element is not zero and the second array element is zero, the first array element may be converted into another binary characteristic value for indicating the formation of an order between the first array element and the second array element.
For example, if the first array element has an element value of 1 and the second array element has an element value of 2, the first array element may be converted to "0"; if the first array element has an element value of 1 and the second array element has an element value of 0, the first array element may be converted to "01".
On one hand, each converted binary characteristic value is generated according to the element values of the two array elements associated with the card value index, and the element values of the two array elements associated with the card value index can reflect whether the hands form a sequence relation or not, so that the binary characteristic value can reflect the hands with the sequence relation in the card type. For example, the card value index respectively corresponds to two array elements of the card values "ten thousand" and "twenty thousand", the element values of which are all 1, i.e., the card values are one card for each of the hands of "ten thousand" and "twenty thousand", correspondingly, the array element of the card value index corresponding to "ten thousand" is converted into the binary characteristic value 0, then, the card value index respectively corresponds to two array elements of the card values "twenty thousand" and "thirty thousand", the element values thereof are also all 1, and correspondingly, the array element of the card value index corresponding to "twenty thousand" is converted into the binary characteristic value 0. That is, the two binary characteristic values "0" and "0" can reflect that there are "ten thousand", "twenty thousand" and "thirty thousand" sequential subrelations in the hand card type. On the contrary, if the element value of the array element corresponding to the card value "thirty thousand" is 0, the array element corresponding to the card value "twenty thousand" is converted into the binary characteristic value 01, so that the two binary characteristic values "0" and "01" can reflect that only ten thousand and twenty thousand of the hands are the non-compliant sub-hands. Therefore, the array elements are converted into the binary characteristic values in the mode, so that the related information of the sequential sub-hands belonging to different suits in the card values is omitted, only the key information of whether the record meets the winning condition is reserved, the array with large data volume and recording the related information of the complete hand card type is simplified into the binary characteristic values only recording the key information influencing the win-or-lose judgment result, and less memory resources and processor resources can be occupied in the subsequent process of matching the winning card type characteristic values with the hand card type characteristic values.
On the other hand, compared with the matching between decimal eigenvalues, the computer carries out matching processing on binary eigenvalues, and can occupy less memory resources and processor resources.
Therefore, by converting the array elements into the binary characteristic values according to the preset conversion rule, the win-loss judgment is ensured to be accurately carried out, and meanwhile, the consumption of memory resources and processor resources is reduced.
The server 120 traverses each array element of the card type array until each array element in the card type array is converted to a binary characteristic value.
In step S240, a hand type feature value is obtained according to the binary feature value of each array element.
The hand type characteristic value may be a numerical value representing a characteristic of the hand type. In practical applications, a key value (a key value used to represent a data feature) may be used as the hand type feature value.
Specifically, the server 120 may concatenate the binary eigenvalues of the array elements according to the card value indexes of the array elements as the hand card type eigenvalue. The server 120 may also splice the binary eigenvalues of the array elements according to the card value indexes of the array elements, perform octal or hexadecimal conversion on the spliced numerical values, and use the converted numerical values as the hand card type eigenvalues.
In step S250, the hand type feature value is matched with each winning type feature value in a preset winning feature value dictionary, and when there is a winning type feature value matched with the hand type feature value, winning prompt information is generated.
The victory card type feature value may be a hand card type feature value calculated from a hand card type satisfying a victory determination condition.
The winning prompting information can be information for prompting that the current hand card type of the user meets the winning judgment condition.
Specifically, the server 120 may advance through various hand types meeting winning conditions, and for the purpose of explanation, the hand type meeting winning determination conditions is named a winning hand type. Then, in the manner shown above, the characteristic values of the winning hand types of the respective winning hand types are calculated, and a winning characteristic value dictionary in which the characteristic values of the respective winning hand types are recorded is generated using map < key > (a data structure constructed based on a mapping relationship).
The server 120 may compare the hand card type characteristic value calculated for the current hand card type of the user with each winning card type characteristic value in the winning characteristic value dictionary, and when the hand card type characteristic value is matched with each winning card type characteristic value in the winning characteristic value dictionary, it may be determined that the current hand card type meets the winning determination condition, and at this time, the server 120 may generate winning prompt information and issue the winning prompt information to the terminal 110, and the winning prompt information is displayed to the user by the terminal 110 to prompt the user to select whether to execute a winning confirmation operation.
It should be noted that, in the above embodiment, each specific step is described by taking a win or loss judgment example of a mahjong game, but a person skilled in the art may apply the scheme provided in the above embodiment to various chess games including bridge games, for example, for a bridge game, a certain hand type is [ spade 1, spade 2, block 4, block 5, and spade J ], and similarly, a card type array may be generated according to the hand type, and a subsequent win or loss judgment step may be performed based on the card type array, which is not described herein again.
In the game control method, firstly, a card type array containing attributes such as card value indexes and element numerical values is generated according to the card values of all hands in the hand card type of a user, then, a first array element and a second array element which have incidence relation with the card value indexes are utilized to convert the first array element into binary characteristic values until the binary characteristic values of all array elements are obtained, finally, the hand card type characteristic values are matched with all winning card type characteristic values in a winning characteristic value dictionary according to the binary characteristic values, prompt information is generated during matching, therefore, when the victory or the negativity of a chess game is judged, whether the chess game wins or not can be judged without adopting a complicated victory or negativity judgment mode through single matching of the hand card type characteristic values and the winning card type characteristic values, and the operation amount of the victory or the negativity judgment is reduced, and because the card value index and the card value have a corresponding relation, and the element numerical value records the number of hands with the card value corresponding to the card value index, therefore, the complete hand card type can be recorded through a one-dimensional array with a simpler data structure, and then the array element is converted into a binary characteristic value through a preset conversion rule. Therefore, on the premise of ensuring the accuracy of the win-loss judgment, the consumption of memory resources and processor resources in the win-loss judgment processing is reduced.
Moreover, under the scene that a large number of users play online chess and card games, the efficiency of controlling the victory or defeat judgment by the server is improved, and the users do not need to wait for the victory or defeat judgment processing of the server for a long time.
Further, when the game control method is applied to a mobile terminal with relatively limited memory resources and processor resources, resource consumption of the mobile terminal by the win-loss judgment processing is effectively reduced, and the problem that the mobile terminal needs to spend a large amount of time for win-loss judgment due to insufficient resources is solved.
In an exemplary embodiment, as shown in fig. 3, in step S240, the conversion of the hand type feature value may be specifically realized by the following steps:
in step S241, the binary eigenvalues of the array elements are combined according to the brand index of the array elements to obtain an eigenvalue combination value.
In step S242, the feature value combination value is converted into a hexadecimal feature value as the hand type feature value.
Specifically, after converting each array element into a binary feature value, the server 120 may combine the binary feature values obtained by converting each array element into feature value combination values in ascending order of the tile value index of the array element.
For example, the brand value indexes of the first array element, the second array element, and the third array element are "1", "2", and "3", respectively, the binary feature values obtained by conversion are "01", "0111", and "0", respectively, and the binary feature values are combined in ascending order of the brand value indexes "1", "2", and "3", to obtain the feature value combination value "0101110".
Then, the server 120 converts the combination value of the feature values into a hexadecimal numerical value, i.e., the hexadecimal feature value described above, and takes the hexadecimal feature value as a hand type feature value of the hand type.
In the game control method, the binary characteristic values of the array elements are combined into the hexadecimal characteristic value in sequence to serve as the hand card type characteristic value, and the hexadecimal value occupies less memory resources, so that the consumption of the memory resources in the victory or defeat judgment processing can be further reduced on the premise of ensuring the accuracy of the victory or defeat judgment.
In an exemplary embodiment, in step S230, the element value of the first array element is converted into a binary feature value according to the element value of the first array element and the element value of the second array element, which may specifically be implemented by the following steps:
step S231, when the element value of the first array element is not zero and the element value of the second array element is zero, converting the element value of the first array element into the non-cis-sub-feature value;
in step S232, when the element value of the first array element is not zero and the element value of the second array element is not zero, the element value of the first array element is converted into the order sub-feature value.
The order sub-feature value may be a binary feature value used for recording that an order sub-relationship is formed, and the non-order sub-feature value may be a binary feature value used for recording that an order sub-relationship is not formed. For example, the cis sub-feature value may be "011", and the non-cis sub-feature value may be "0111".
Specifically, the server 120 may traverse each array element, and when traversing to the first array element, first determine whether the element value of the first array element is 0, and if the element value of the first array element is 0 (i.e., there is no hand with the card value corresponding to the card value index of the first array element in the hand type), skip without performing conversion.
If the element value of the first array element is not 0, further determining a second array element associated with the card value index, then acquiring the element value of the second array element, and judging whether the element value of the second array element is 0 or not. If the element value of the second array element is 0, the element value of the first array element is converted into a non-cis sub-feature value. If the element value of the second array element is not 0, the element value of the first array element is converted to a cis-sub feature value.
For example, if the element value of the first array element is 1 and the element value of the second array element is 0, the first array element is converted into a non-cis sub-feature value of "01"; if the element value of the second array element is 2, the first array element is converted to a cis-sub feature value of "0".
In practical applications, the element values of the first array element may be further converted into different non-cis-sub characteristic values or cis-sub characteristic values according to specific values of the element values of the first array element.
An exemplary binary feature value transformation rule is as follows:
when the element value of the first array element is '1' and the element value of the second array element is '0', the element value '1' of the first array element is converted into '01';
when the element value of the first array element is '1' and the element value of the second array element is not '0', the element value '1' of the first array element is converted into '0';
when the element value of the first array element is '2' and the element value of the second array element is '0', the element value '2' of the first array element is converted into '0111';
when the element value of the first array element is '2' and the element value of the second array element is not '0', the element value '2' of the first array element is converted into '011';
when the element value of the first array element is "3" and the element value of the second array element is "0", the element value "3" of the first array element is converted into "011111";
when the element value of the first array element is '3' and the element value of the second array element is not '0', the element value '3' of the first array element is converted into '01111';
when the element value of the first array element is "4" and the element value of the second array element is "0", the element value "3" of the first array element is converted into "01111111";
when the element value of the first array element is "4" and the element value of the second array element is not "0", the element value "3" of the first array element is converted to "0111111".
It should be noted that the hand of the same hand value is 4 at most, and thus the element value ranges from 0 to 4.
It should be further noted that, in practical applications, a person skilled in the art may set different binary characteristic values for distinguishing the cis sub characteristic value from the non-cis sub characteristic value according to practical needs. For example, the non-cis-sub characteristic value may be "001", the cis-sub characteristic value may be "0011", and the present embodiment does not limit specific numerical values of the non-cis-sub characteristic value and the cis-sub characteristic value.
It should be noted that the above conversion rule is applicable to non-wind cards (i.e., numerical elements with a card value index of 0 to 26) with suits of "ten" and "barrel" and that, for wind cards (i.e., numerical elements with a card value index of 27 to 33) with the same rank, the wind cards can be directly converted into corresponding binary characteristic values according to the element numerical values of the first array elements without being converted by the above conversion rule because there is no sequential relationship between the wind cards. For example, if the element value of the array element of the brand value index 27 (corresponding to the brand value "east") is 1, it is converted into a binary feature value "01", the element value is 2, it is converted into "0111", and so on.
In the game control method, the first array element is correspondingly converted into the non-sequence characteristic value or the sequence characteristic value according to the judgment result of whether the second array element is zero, so that whether the hand card forms sequence relation or not can be distinguished and recorded through a small amount of information, the data structure of related data influencing the win-loss judgment result is simplified, and the win-loss judgment processing can be completed under the condition of consuming less memory resources and processor resources.
In an exemplary embodiment, step S220 may be specifically realized by the following steps.
In step S221, in the array elements of the brand type array, a target element is determined;
in step S222, a target card value index is determined; the target card value index is a card value index of the target element;
in step S223, in the hand type, a hand whose card value matches the card value corresponding to the target card value index is searched for as the target hand;
in step S224, the number of the target hand is counted as the element value of the target element.
Specifically, the server 120 may first determine the target element, and then search, according to the target card value index of the target element, a hand with a card value matching the card value corresponding to the target card value index from among the hands of the hand type as the target hand. And finally, counting the number of the target hand in the hand type, and assigning values to the array elements according to the number to obtain the element values of the array elements.
In the game control method, the hands with the matched card values are found out in the hand card types according to the card values corresponding to the card value indexes of the array elements, and the number of the hands is counted, so that the element values of the array elements can be obtained through simple operation processing, the time consumed by the victory or defeat judgment processing is reduced, and the efficiency of the victory or defeat judgment processing is improved.
In an exemplary embodiment, before step S210, the following steps may be further included.
Acquiring a winning card type; the victory card type is composed of a plurality of the hands; generating a victory card type array of the victory card types according to the card value of each hand in the victory card types; determining a third array element and a fourth array element associated with the card value index in the winning card type array, and converting the element value of the third array element into a binary characteristic value according to the element value of the third array element and the element value of the fourth array element until traversing the binary characteristic value of each array element in the winning card type array; obtaining the characteristic value of the winning brand type according to the binary characteristic value of each array element in the array of the winning brand type; generating the winning feature value dictionary; the winning feature value dictionary includes the winning hand type feature values.
Specifically, the server 120 may generate winning hand type feature values representing winning hand types that meet winning conditions in advance, and generate a winning feature value dictionary based on the winning hand type feature values. Since the processing procedure of the feature value of the victory card type is substantially the same as that of the hand card type feature value of the above embodiment, it is not described herein again.
In the game control method, the winning judgment is carried out by adopting the winning card type characteristic value in the winning characteristic value dictionary, the complete winning card type can be recorded through the one-dimensional array with a simpler data structure, and then the array element is converted into the binary characteristic value through the preset conversion rule.
It should be understood that although the steps in the flowcharts of fig. 2 to 3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 to 3 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or at least partially with other steps or steps in other steps.
FIG. 4 is a block diagram illustrating a game control device according to an exemplary embodiment. Referring to fig. 4, the apparatus includes the following units.
A card type acquisition unit 402 configured to perform acquisition of hand card types; the hand card type consists of a plurality of hands; the hand has a card value;
an array generating unit 404 configured to perform generating a card type array of the hand card types according to the card values of the respective hands in the hand card types; the card type array comprises array elements; the array elements have a card value index and an element value; the card value index and the card value have a corresponding relation; the element numerical value is generated according to the number of the target hand; the card value of the target hand is matched with the card value corresponding to the card value index of the array element;
a binary conversion unit 406 configured to execute, in the card type array, determining a first array element and a second array element associated with the card value index, and converting the element value of the first array element into a binary feature value according to the element value of the first array element and the element value of the second array element until traversing the binary feature value of each array element in the card type array;
a feature value generating unit 408 configured to perform obtaining a hand card type feature value according to the binary feature value of each array element;
and a winning prompting unit 410 configured to perform matching of the hand type feature value with each winning hand type feature value in a preset winning feature value dictionary, and generate winning prompting information when there is a winning hand type feature value matching the hand type feature value.
In an exemplary embodiment, the feature value generating unit 408 is configured to perform:
combining the binary characteristic values of the array elements according to the brand value indexes of the array elements to obtain characteristic value combination values;
and converting the characteristic value combination value into a hexadecimal characteristic value as the hand type characteristic value.
In an exemplary embodiment, the binary characteristic value includes at least a cis sub characteristic value and a non-cis sub characteristic value, and the binary conversion unit 406 is configured to perform:
when the element value of the first array element is not zero and the element value of the second array element is zero, converting the element value of the first array element into the non-cis sub-feature value;
and when the element value of the first array element is not zero and the element value of the second array element is not zero, converting the element value of the first array element into the order sub characteristic value.
In an exemplary embodiment, the array generating unit 404 is configured to perform:
determining a target element in array elements of the card type array;
determining a target card value index; the target card value index is a card value index of the target element;
searching a hand with the card value matched with the card value corresponding to the target card value index in the hand card type to serve as the target hand;
and counting the number of the target hand as the element value of the target element.
In an exemplary embodiment, the apparatus is further configured to perform:
acquiring a winning card type; the victory card type is composed of a plurality of the hands;
generating a victory card type array of the victory card types according to the card value of each hand in the victory card types;
determining a third array element and a fourth array element associated with the card value index in the winning card type array, and converting the element value of the third array element into a binary characteristic value according to the element value of the third array element and the element value of the fourth array element until traversing the binary characteristic value of each array element in the winning card type array;
obtaining the characteristic value of the winning brand type according to the binary characteristic value of each array element in the array of the winning brand type;
generating the winning feature value dictionary; the winning feature value dictionary includes the winning hand type feature values.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 5 is a flow diagram illustrating a win determination according to an exemplary embodiment. Referring to fig. 5, when a user connects to the server 120 through the terminal 110 to participate in a game, the server 120 may load a winning key dictionary constructed based on a map data structure, the winning key dictionary including a plurality of keys generated by the method of the above-described embodiment according to the hand type satisfying the winning condition. After the game starts, the server 120 generates a Key according to the hand in the hand type of the user, then searches whether a Key matched with the Key exists in a winning Key dictionary, if not, the current hand type is judged not to accord with the winning condition, if so, the winning condition is judged to be met, and a winning prompt is generated and fed back to the user.
Fig. 6 is a block diagram illustrating an apparatus 600 for performing a game control method according to an exemplary embodiment. For example, the device 600 may be a server. Referring to fig. 6, device 600 includes a processing component 620 that further includes one or more processors and memory resources, represented by memory 622, for storing instructions, such as applications, that are executable by processing component 620. The application programs stored in memory 622 may include one or more modules that each correspond to a set of instructions. Further, the processing component 620 is configured to execute instructions to perform the game control method described above.
The device 600 may also include a power component 624 configured to perform power management for the device 600, a wired or wireless network interface 626 configured to connect the device 600 to a network, and an input/output (I/O) interface 628. The device 600 may operate based on an operating system stored in the memory 622, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or the like.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 622 comprising instructions, executable by the processor of the device 600 to perform the method described above is also provided. The storage medium may be a computer-readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product comprising a computer program which, when executed by a processor, implements the game control method described above.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A game control method, comprising:
acquiring a hand card type; the hand card type consists of a plurality of hands; the hand has a card value;
generating a card type array of the hand card type according to the card value of each hand in the hand card type; the card type array comprises array elements; the array elements have a card value index and an element value; the card value index and the card value have a corresponding relation; the element numerical value is generated according to the number of the target hand; the card value of the target hand is matched with the card value corresponding to the card value index of the array element;
determining a first array element and a second array element associated with the card value index in the card type array, and converting the element value of the first array element into a binary characteristic value according to the element value of the first array element and the element value of the second array element until traversing the binary characteristic value of each array element in the card type array;
obtaining a hand card type characteristic value according to the binary characteristic value of each array element;
and matching the hand type characteristic value with each victory card type characteristic value in a preset victory characteristic value dictionary, and generating victory prompt information when the victory card type characteristic value matched with the hand type characteristic value exists.
2. The game control method of claim 1, wherein obtaining a hand type characteristic value from the binary characteristic values of the respective array elements comprises:
combining the binary characteristic values of the array elements according to the brand value indexes of the array elements to obtain characteristic value combination values;
and converting the characteristic value combination value into a hexadecimal characteristic value as the hand type characteristic value.
3. The game control method according to claim 1, wherein the binary feature value includes at least a cis-sub feature value and a non-cis-sub feature value, and the converting the element value of the first array element into the binary feature value according to the element value of the first array element and the element value of the second array element includes:
when the element value of the first array element is not zero and the element value of the second array element is zero, converting the element value of the first array element into the non-cis sub-feature value;
and when the element value of the first array element is not zero and the element value of the second array element is not zero, converting the element value of the first array element into the order sub characteristic value.
4. The game control method of claim 1, wherein generating a card type array of the hand card types based on the card values of each of the hands in the hand card types comprises:
determining a target element in array elements of the card type array;
determining a target card value index; the target card value index is a card value index of the target element;
searching a hand with the card value matched with the card value corresponding to the target card value index in the hand card type to serve as the target hand;
and counting the number of the target hand as the element value of the target element.
5. The game control method of claim 1, wherein prior to obtaining the hand type, further comprising:
acquiring a winning card type; the victory card type is composed of a plurality of the hands;
generating a victory card type array of the victory card types according to the card value of each hand in the victory card types;
determining a third array element and a fourth array element associated with the card value index in the winning card type array, and converting the element value of the third array element into a binary characteristic value according to the element value of the third array element and the element value of the fourth array element until traversing the binary characteristic value of each array element in the winning card type array;
obtaining the characteristic value of the winning brand type according to the binary characteristic value of each array element in the array of the winning brand type;
generating the winning feature value dictionary; the winning feature value dictionary includes the winning hand type feature values.
6. A game control apparatus, comprising:
a card type acquisition unit configured to perform acquisition of a hand card type; the hand card type consists of a plurality of hands; the hand has a card value;
an array generating unit configured to execute generating a card type array of the hand card types according to the card values of the hands in the hand card types; the card type array comprises array elements; the array elements have a card value index and an element value; the card value index and the card value have a corresponding relation; the element numerical value is generated according to the number of the target hand; the card value of the target hand is matched with the card value corresponding to the card value index of the array element;
a binary conversion unit configured to execute, in the card type array, determining a first array element and a second array element associated with the card value index, and converting an element value of the first array element into a binary feature value according to the element value of the first array element and the element value of the second array element until traversing the binary feature value of each array element in the card type array;
the characteristic value generating unit is configured to execute binary characteristic values according to the array elements to obtain hand card type characteristic values;
and the winning prompting unit is configured to match the hand type characteristic value with each winning type characteristic value in a preset winning characteristic value dictionary, and generate winning prompting information when the winning type characteristic value matched with the hand type characteristic value exists.
7. The game control apparatus according to claim 6, characterized by a feature value generation unit configured to execute:
combining the binary characteristic values of the array elements according to the brand value indexes of the array elements to obtain characteristic value combination values;
and converting the characteristic value combination value into a hexadecimal characteristic value as the hand type characteristic value.
8. A server, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the game control method of any one of claims 1 to 5.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of a server, enable the server to perform a game control method as recited in any one of claims 1 to 5.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the game control method of any one of claims 1-5 when executed by a processor.
CN202110254202.9A 2021-03-09 2021-03-09 Game control method, game control device, server and storage medium Active CN113058271B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110254202.9A CN113058271B (en) 2021-03-09 2021-03-09 Game control method, game control device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110254202.9A CN113058271B (en) 2021-03-09 2021-03-09 Game control method, game control device, server and storage medium

Publications (2)

Publication Number Publication Date
CN113058271A true CN113058271A (en) 2021-07-02
CN113058271B CN113058271B (en) 2024-02-23

Family

ID=76560307

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110254202.9A Active CN113058271B (en) 2021-03-09 2021-03-09 Game control method, game control device, server and storage medium

Country Status (1)

Country Link
CN (1) CN113058271B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1990073A (en) * 2005-12-29 2007-07-04 腾讯科技(深圳)有限公司 Operation control method and system for card game terminal
CN101732861A (en) * 2008-11-14 2010-06-16 康佳集团股份有限公司 Automatic card selecting method and system in electronic playing card game
US20120289299A1 (en) * 2011-05-12 2012-11-15 Christopher Stevens Method of ranking a poker hand
CN105447296A (en) * 2014-09-25 2016-03-30 博雅网络游戏开发(深圳)有限公司 Poker hand pattern sequence data processing system, apparatus and method and Poker card order sequence data processing system, apparatus and method
CN108926843A (en) * 2017-05-22 2018-12-04 周少华 The control method and system won the game in a kind of mahjong class game
CN110478908A (en) * 2019-08-22 2019-11-22 网易(杭州)网络有限公司 The control method and device of Random Factor Mahjong, storage medium, electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1990073A (en) * 2005-12-29 2007-07-04 腾讯科技(深圳)有限公司 Operation control method and system for card game terminal
CN101732861A (en) * 2008-11-14 2010-06-16 康佳集团股份有限公司 Automatic card selecting method and system in electronic playing card game
US20120289299A1 (en) * 2011-05-12 2012-11-15 Christopher Stevens Method of ranking a poker hand
CN105447296A (en) * 2014-09-25 2016-03-30 博雅网络游戏开发(深圳)有限公司 Poker hand pattern sequence data processing system, apparatus and method and Poker card order sequence data processing system, apparatus and method
CN108926843A (en) * 2017-05-22 2018-12-04 周少华 The control method and system won the game in a kind of mahjong class game
CN110478908A (en) * 2019-08-22 2019-11-22 网易(杭州)网络有限公司 The control method and device of Random Factor Mahjong, storage medium, electronic equipment

Also Published As

Publication number Publication date
CN113058271B (en) 2024-02-23

Similar Documents

Publication Publication Date Title
CN111552880B (en) Knowledge graph-based data processing method and device, medium and electronic equipment
CN108961052A (en) Verification method, storage method, device, equipment and the medium of block chain data
CN108197211A (en) A kind of information recommendation method, device, server and storage medium
CN112035638B (en) Information processing method, device, storage medium and equipment
CN111309481A (en) Resource acquisition method, device, terminal and storage medium
CN110119477A (en) A kind of information-pushing method, device and storage medium
CN112734498B (en) Task rewarding acquisition method, device, terminal and storage medium
JP2022500808A (en) Statement generation methods and devices, electronic devices and programs
CN113297269A (en) Data query method and device
CN115454561A (en) Customized interface display method, device, equipment and storage medium
US20110302174A1 (en) Crowd-sourcing for gap filling in social networks
CN112818080B (en) Searching method, searching device, searching equipment and storage medium
CN110264277A (en) Data processing method and device, medium and the calculating equipment executed by calculating equipment
CN109657048A (en) One kind being applied to answerer&#39;s recommended method in open source Ask-Answer Community
CN109408755A (en) Data processing method, device, terminal device and computer storage medium
CN113058271A (en) Game control method, device, server and storage medium
CN112270384A (en) Loop detection method and device, electronic equipment and storage medium
CN112069337A (en) Picture processing method and device, electronic equipment and storage medium
CN111046092A (en) Parallel similarity connection method based on CPU-GPU heterogeneous system structure
CN110442681A (en) A kind of machine reads method, electronic equipment and the readable storage medium storing program for executing of understanding
CN110505276A (en) Object matching method, apparatus and system, electronic equipment and storage medium
CN115618949A (en) User interest analysis method and system based on immersive meta universe service
CN113934894A (en) Data display method based on index tree and terminal equipment
CN110807599A (en) Method, device, server and storage medium for deciding electrochemical energy storage scheme
CN111125425A (en) Method, system and device for reading and writing video data and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant