Disclosure of Invention
In view of the above deficiencies of the related art, the present application aims to provide an online chess and card processing method, a server and a storage medium, and aims to solve the problems of insufficient fairness of online chess and card game results and poor user experience in the related art.
In order to solve the technical problem, the invention provides an online chess and card processing method, which comprises the following steps:
determining the card groups sequenced in the server;
generating identification information corresponding to the card group;
and conducting a card game based on the sequenced card groups, and verifying the card game through the identification information.
Optionally, the generating the identification information corresponding to the card set includes:
generating first summary information corresponding to the card group through a summary algorithm; the identification information includes the first summary information.
Optionally, the method further includes: and when the card game starts, the first summary information is published to each client.
Optionally, the generating, by using a summary algorithm, first summary information corresponding to the deck group includes:
and generating first digest information corresponding to the card set through a digest algorithm version 5MD5, a secure hash algorithm SHA and a hash message authentication code MAC.
Optionally, the generating the identification information corresponding to the card set further includes:
generating a key;
splicing the secret key and the card set to form an encrypted data set;
generating second summary information corresponding to the encrypted data set through a summary algorithm; the identification information includes the second digest information.
Optionally, the verifying the deals through the identification information includes:
and after the card game is finished, verifying the card group in the card game through the identification information.
Optionally, the verifying the deals through the identification information includes:
receiving a verification request of at least one client;
and verifying the card group in the card game through the identification information.
Optionally, before determining the card groups that have been sequenced in the server, the method further includes:
shuffling the playing cards in the set.
The invention also provides a server, which comprises a processor, a memory and a communication bus;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is configured to execute one or more computer programs stored in the memory to implement the steps of the above-described online board processing method.
The present invention also provides a computer readable storage medium storing one or more computer programs, the one or more computer programs being executable by one or more processors to implement the steps of the above-described online board processing method.
Advantageous effects
The invention provides an online chess and card processing method, a server and a storage medium, which are used for determining a card group sequenced in a server; generating identification information corresponding to the card group; conducting a card game based on the sequenced card groups, and verifying the card game through identification information; therefore, the invention sequences the card groups first, generates the corresponding identification information by the sequenced card groups, and verifies the card deals based on the identification information, thereby effectively avoiding cheating actions of card changing in the card dealing process, ensuring the fairness of the card deals and improving the user experience.
Detailed Description
To facilitate an understanding of the present application, the present application will now be described more fully with reference to the accompanying drawings. Preferred embodiments of the present application are given in the accompanying drawings. This application may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
Referring to fig. 1, fig. 1 shows a flow chart of an online chess and card processing method according to an embodiment of the present invention; the method comprises the following steps:
s101, determining a sequenced card group in a server;
s102, generating identification information corresponding to the card group;
s103, conducting a card game based on the sequenced card groups, and verifying the card game through the identification information.
The online chess and card game is a game which uses card groups to enable each player to play in corresponding game rules so as to win or lose. In the online chess and card game, the game process of the game of cards needs to examine the technique of players and consider the fortune of dealing cards. In the related art, the types of online chess and cards include, but are not limited to, mahjongg, poker, sanguo, younuo (UNO), and the like, to a lesser extent. The online chess and card is characterized in that in the process of ordinary game-play, the card set is distributed to the sub-card sets of each player, only the player knows the game-play, and the player does not know the sub-card sets of other players; as the game progresses, the playing cards in the set are known to other players as they are used or played. Therefore, it is very important to ensure that cheating behaviors such as changing cards and the like do not occur in the game.
At S101, the server determines the set of cards in the server that is the set of cards that have been sequenced. The term "ordered card set" is understood to mean that, in the game, the mutual sequence between the cards of the card set is already established, and, at the start of the game, the game is carried out according to the currently ordered card set. In other words, a sequenced set of cards refers to the initial set of cards in each hand whose order of the set at the time of the hand is made is determined even though the set may change during the course of the hand due to the rules of the hand.
The sequenced card group is the source of the card game verification; the card game is verified, namely whether the sub-card groups of each user correspond to the sequenced card groups or not is judged based on the game matching process and the game matching result, and if so, the game matching process is normal; if the card is not corresponding to the card, in the process of showing the card game, a player adopts a cheating means, so that the card game can be further processed, including card game waste, punishment on cheaters and the like.
In S102, identification information corresponding to the card group is generated. The sequenced card set comprises the content of each chess and cards and the sequence of the chess and cards which are already determined, and the identification information corresponding to the card set can be uniquely determined according to the content and the sequence of the chess and cards.
One obvious feature of card sets during the course of a deal is that they are not known to other players; in order to make the other players unknown, therefore, the recording means for the card set should be processed for the players, and the players cannot directly know the content of the card set through the recording means; specifically, the identification information does not allow each player in the game to directly know the contents of the deck.
In some optional embodiments, generating the identification information corresponding to the card group may specifically include:
generating first summary information corresponding to the card group through a summary algorithm; the identification information includes first digest information. Through the summarization algorithm, the content and the sequence of the card groups can be presented in the form of summarized content. The Message Digest (Message Digest) is also called a Digital Digest (Digital Digest). Which is a fixed length value that uniquely corresponds to a message or text, can be generated by a one-way Hash encryption function acting on the message. If the message has changed en route, the recipient knows whether the message has changed by comparing the newly generated digest of the received message with the original digest. The message digest thus ensures the integrity and consistency of the message.
The message digest may be a one-way Hash function that "digests" the plaintext to be encrypted into a series of ciphertexts with a fixed number of bits (e.g., 128 bits), which is also called a digital fingerprint (Finger Print), and the series of ciphertexts has a fixed length, and different digests of the plaintext are ciphertexts, and the result is always different, and the digests of the same plaintext must be consistent. Thus, the series of digests can be used as a 'fingerprint' for verifying whether the plaintext is 'real' or not. Through the first abstract information, the information of the corresponding card group can be uniquely determined, so that the fairness of the game is ensured.
In some optional embodiments, the method may further include: and when the card game starts, the first summary information is published to each client. After the first summary information is obtained through the summary algorithm, the first summary information can be published in the card game process, and the published result can be known by all players, so that the players can supervise the card game according to the published first summary information. Of course, during the playing process, the player cannot know the corresponding playing contents through the first summary information.
In some optional embodiments, the generating of the first summary information corresponding to the deck group by using the summary algorithm may specifically include:
and generating first digest information corresponding to the card set through the digest algorithm version 5MD5, the secure hash algorithm SHA and the hash message authentication code MAC. Among them, MD (Message Digest) is a family of algorithms which are widely used, and particularly, MD5(Message-Digest Algorithm version 5), which is developed from MD2, MD3 and MD4, and proposed by Ron Rivest (RSA corporation) in 1992, is currently widely used for data integrity check, data (Message) Digest, data encryption, and the like. MD2, MD4, and MD5 all generate 16-byte (128-bit) check values, typically represented by 32-bit hexadecimal numbers. The algorithm of MD2 is slower but relatively safe, MD4 is fast but safety is reduced, and MD5 is safer and faster than MD 4.
The SHA (Secure Hash Algorithm) is established by the National Institute of Standards and Technology (NIST), a standard organization specially established for cryptographic algorithms in the United states, and the digest lengths of the SHA series of algorithms are respectively as follows: SHA-1 is 20 bytes (160 bits), SHA-224 is 32 bytes (224 bits), SHA-256 is 32 bytes (256 bits), SHA-384 is 48 bytes (384 bits), SHA-512 is 64 bytes (512 bits), and is safer than MD5 because it generates a data digest that is longer in length and thus more difficult to collide, which is the development direction of future data digest algorithms. Since the data digest length of the SHA series algorithm is long, the operation speed is relatively slow compared to MD 5.
The MAC (Hash Message Authentication Code) is a Hash function algorithm containing a key, is compatible with the characteristics of MD and SHA algorithms, and is added with the key on the basis of the MD and SHA algorithms. The MAC algorithm is therefore often also referred to as HMAC algorithm. The hash value of the message is controlled by a key known only to the two communicating parties. The Hash value is now called MAC.
The digest value obtained by the MAC algorithm may also be represented by hexadecimal coding, and the length of the digest value is the same as the length of the digest value used to implement the algorithm.
In addition, the corresponding first summary information may be generated by other summary algorithms, which is not limited in the embodiment of the present invention.
In some optional embodiments, generating the identification information corresponding to the card set may further include:
generating a key;
splicing the secret key and the card group to form an encrypted data group;
generating second summary information corresponding to the encrypted data set through a summary algorithm; the identification information includes second digest information. In addition to generating the summary information corresponding to the card set, namely the first summary information, directly through the summary algorithm, a key can be generated before the first summary information, an encrypted data set is formed through splicing the key and the card set, then the summary algorithm is executed on the encrypted data set to generate the second summary information, and the safety of the summary information is further improved. The digest algorithm may also be MD5, SHA, MAC, etc., and the embodiments of the present invention do not limit the same.
In this process, the identification information may include a previously generated key in addition to the second digest information. The second summary information and the key may be published to the clients, i.e., to the players in the hand, at the beginning of the hand.
In S103, a card hand is made based on the already sequenced card set, and the card hand is verified by the identification information. In S101, the content and the sequence of each chess and card set are determined, and the current card game is started without changing; therefore, the current card game can be verified through the generated identification information.
Specifically, the verifying the card game through the identification information may include:
and after the card game is finished, verifying the card group in the card game through the identification information. In other words, the verification of the hands may be performed after each hand is completed to ensure that each hand is fair to each player.
In some optional embodiments, verifying the deals with the identification information may further include:
receiving a verification request of at least one client;
and verifying the card group in the card game through the identification information. In addition to the verification after each round is finished, the verification can be performed according to the verification request of the player, that is, the server can receive the verification request of the client and perform the verification of the round according to the verification request. This process amounts to initiating a verification request if the player feels a problem with the game.
In some optional embodiments, before determining the card groups already sequenced in the server, the method may further include: the playing cards in the card group are shuffled. For some chess and card games, cards can be shuffled every play, namely, the content and the sequence of the card groups are random every play; the cards can also be played without shuffling each time, namely, the cards can be played without shuffling, and the embodiment of the invention is not limited to the cards.
The embodiment of the invention provides an online chess and card processing method, which comprises the steps of determining a card group sequenced in a server; generating identification information corresponding to the card group; conducting a card game based on the sequenced card groups, and verifying the card game through identification information; therefore, the invention sequences the card groups first, generates the corresponding identification information by the sequenced card groups, and verifies the card deals based on the identification information, thereby effectively avoiding cheating actions of card changing in the card dealing process, ensuring the fairness of the card deals and improving the user experience.
Another alternative embodiment of the present invention provides an online chess and card processing method, please refer to fig. 2, which includes:
s201, shuffling the card group by the server;
s202, generating corresponding first summary information for the sequenced card groups through a summary algorithm;
s203, publishing the first summary information to each client;
s204, starting the current card game by the sequenced card groups;
s205, when the card game is finished, the card game is verified according to the first summary information.
Another alternative embodiment of the present invention provides an online chess and card processing method, please refer to fig. 3, which includes:
s301, shuffling the card group by the server;
s302, generating a secret key according to a preset rule;
s303, combining the sequenced card groups after being washed with a secret key, and generating corresponding second abstract information through an abstract algorithm;
s304, publishing the second abstract information to each client;
s305, starting the current card game by using the sequenced card groups;
s306, when the card game is finished, a secret key is published;
s307, verifying the card game according to the second abstract information and the secret key.
Referring to fig. 4, the server according to an embodiment of the present invention further includes aprocessor 41, amemory 42, and acommunication bus 43;
thecommunication bus 43 is used for realizing connection communication between theprocessor 41 and thememory 42;
processor 41 is operative to execute one or more computer programs stored inmemory 42 to implement the steps of an online chess and card processing method in an embodiment of the present invention
Embodiments of the present invention also provide a computer-readable storage medium including volatile or non-volatile, removable or non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, computer program modules or other data. Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash Memory or other Memory technology, CD-ROM (Compact disk Read-Only Memory), Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer.
The computer-readable storage medium in the embodiments of the present invention may be used for storing one or more computer programs, and the one or more stored computer programs may be executed by one or more processors to implement the steps of the online chess and card processing method in the embodiments of the present invention.
The embodiment of the present invention further provides a computer program (or computer software), which can be distributed on a computer readable medium and executed by a computing device to implement at least one step of the above-mentioned online chess and card processing method; and in some cases at least one of the steps shown or described may be performed in an order different than that described in the embodiments above.
Embodiments of the present invention further provide a computer program product, which includes a computer readable device, where the computer program as shown above is stored on the computer readable device. The computer readable device in the embodiment of the present invention may include a computer readable storage medium as shown above.
It will be apparent to those skilled in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software (which may be implemented in computer program code executable by a computing device), firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit.
In addition, communication media typically embodies computer readable instructions, data structures, computer program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to one of ordinary skill in the art. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.