Disclosure of Invention
The application aims to provide a card type data acquisition method, a card type data acquisition device, a server and a computer readable storage medium for the whipped egg game, and solves the problems of low simulation degree and low processing effect of automatic processing of the whipped egg data at present.
In order to solve the technical problem, the application provides a card type data acquisition method for a whipped egg game, which comprises the following steps:
integrating the acquired text logs and the game state dictionary to obtain training data; the game state dictionary is dictionary data acquired when the whipped egg game is initialized;
training the one-dimensional convolution residual error neural network according to the training data to obtain a decision model; wherein, the one-dimensional convolution residual error neural network comprises: the system comprises a one-dimensional convolution network layer, a data fusion module, a batch normalization layer and an activation function layer;
processing the received state information by adopting the decision model to obtain card type data;
and sending the card type data.
Optionally, the step of processing the received state information by using the decision model to obtain card type data includes:
acquiring the status information from the whipped egg game server;
processing the state information by adopting the decision model to obtain initial card type data;
judging whether the initial card type data contains card types combined by the same flowers and sequences; the same-pattern order combination is obtained by combining and arranging the game state dictionary;
if so, carrying out card type combination from card types except the card type combined in the same suit according to the initial card type data to obtain the card type data;
if not, the initial card type data is used as the card type data.
Optionally, performing integration processing according to the acquired text log and the game state dictionary to obtain training data;
obtaining the text log from a whipped egg game server;
converting the text log data into a game state according to a whipped egg game rule model;
and storing and combining the game state and the game state dictionary in a CSV file format to obtain the training data.
Optionally, the step of processing the received state information by using the decision model to obtain card type data includes:
processing the received state information by adopting the decision model to obtain the winning probability of each initial card type data;
and taking the initial card type data with the maximum winning probability as the card type data.
Optionally, sending the card type data includes:
and sending the card type data through an http interface.
Optionally, training the one-dimensional convolution residual neural network according to the training data to obtain a decision model, including:
and training the one-dimensional convolution residual error neural network by adopting an Adam optimizer and the training data to obtain the decision model.
The application also provides a card type data acquisition device of the whipped egg game, include:
the training data acquisition module is used for integrating the acquired text logs and the game state dictionary to obtain training data; the game state dictionary is dictionary data acquired when the whipped egg game is initialized;
the model training module is used for training the one-dimensional convolution residual error neural network according to the training data to obtain a decision model; wherein, the one-dimensional convolution residual error neural network comprises: the system comprises a one-dimensional convolution network layer, a data fusion module, a batch normalization layer and an activation function layer;
the decision model using module is used for processing the received state information by adopting the decision model to obtain card type data;
and the card type data sending module is used for sending the card type data.
Optionally, the training data obtaining module includes:
a text log obtaining unit configured to obtain the text log from a whipped egg game server;
the game state acquisition unit is used for converting the text log data into a game state according to the whipped egg game rule model;
and the merging unit is used for storing and merging the game state and the game state dictionary in a CSV file format to obtain the training data.
The present application further provides a server, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the card type data acquisition method for the whipped egg game as described in the above embodiment when the computer program is executed.
The present application also provides a computer-readable storage medium having stored thereon a computer program that, when being executed by a processor, implements the steps of the card type data acquisition method for the whipped egg game as described in the above embodiments.
The application provides a card type data acquisition method of a whipped egg game, which comprises the following steps: integrating the acquired text logs and the game state dictionary to obtain training data; the game state dictionary is dictionary data acquired when the whipped egg game is initialized; training the one-dimensional convolution residual error neural network according to the training data to obtain a decision model; wherein, the one-dimensional convolution residual error neural network comprises: the system comprises a one-dimensional convolution network layer, a data fusion module, a batch normalization layer and an activation function layer; processing the received state information by adopting the decision model to obtain card type data; and sending the card type data.
Training data obtained by extracting from a text log and a game state dictionary is used for carrying out neural network training to obtain a decision model, and finally, card playing decision is carried out according to the decision model and received state information to obtain card type data instead of automatic card playing by using a rule model, so that more anthropomorphic robot playing operation is realized in a whipped egg game server, and the game data processing effect is improved.
The application also provides a card type data acquisition device, a server and a computer readable storage medium for the whipped egg game, which have the beneficial effects, and are not repeated herein.
Detailed Description
The core of the application is to provide a card type data acquisition method, a card type data acquisition device, a server and a computer readable storage medium for the whipped egg game, and solve the problems of low simulation degree and low processing effect of the automatic processing of the whipped egg data at present.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the related art, in order to improve the actual player participation of the whipped egg game, a logic system based on expert rules is generally adopted. The logic system can calculate the card type combination and the card face value suitable for the own party. However, the combined problems of dealing with the face value of the hand, the face value of the teammate, what is over, the head earning, the help teammate earning, and the like cannot be decided. Thereby influencing the rationality and the anthropomorphic degree of the card playing action data in the whipped egg data and reducing the processing effect on the whipped egg data.
Therefore, the method for acquiring the card type data of the whipped egg game comprises the steps of extracting training data from a text log and a game state dictionary, carrying out a decision model obtained after neural network training, and finally carrying out card playing decision according to the decision model and received state information to obtain the card type data instead of carrying out automatic card playing by using a rule model, so that more anthropomorphic robot playing operation is realized in a whipped egg game server, and the game data processing effect is improved.
Hereinafter, a method of acquiring a card type and data of a whipped egg game provided in the present application will be described with reference to an example.
Referring to fig. 1, fig. 1 is a flowchart of a card type data acquisition method for a whipped egg game provided in an embodiment of the present application.
In this embodiment, the method may include:
s101, integrating the acquired text logs and the game state dictionary to obtain training data; the game state dictionary is dictionary data acquired when the whipped egg game is initialized;
therefore, the step aims to carry out integration processing according to the acquired text logs and the game state dictionary to obtain training data. And the game state dictionary is dictionary data acquired when the whipped egg game is initialized.
The text log refers to the text log of the game continuously recorded by the whipped egg game server in the game process. Generally, the text log is log data mainly used for game participants or spectators to read so as to know the current game situation state. In this embodiment, the text log is directly employed to analyze the current game state without the whipped egg game server retransmitting the dedicated data for data processing. The load of the whipped egg game server is reduced, and the embodiment can be adapted to various different whipped egg game servers without outputting special data to the process in the embodiment by the server, and only the game process needs to be processed normally. The use threshold is reduced, and the use efficiency is improved.
Further, the step may include:
step 1, acquiring a text log from a whipped egg game server;
step 2, converting the text log data into a game state according to the egg whipped game rule model;
and 3, storing and combining the game state and the game state dictionary in a CSV file format to obtain training data.
It can be seen that the present alternative mainly explains how to acquire training data. In this embodiment, the alternative may include obtaining a text log from the whipped egg game server; then, converting the text log data into a game state according to the egg game rule model; and finally, storing and combining the game state dictionary and the game state dictionary in a CSV file format to obtain training data. Among them, a file of a CSV (Comma-Separated Values) file format stores table data (numbers and texts) in a plain text form. Plain text means that the file is a sequence of characters, containing no data that must be interpreted like binary digits. CSV files are composed of any number of records, and the records are separated by a certain linefeed character; each record is made up of fields, and separators between fields are other characters or strings, most commonly commas or tabs.
S102, training the one-dimensional convolution residual error neural network according to training data to obtain a decision model; wherein, the one-dimensional convolution residual error neural network includes: the system comprises a one-dimensional convolution network layer, a data fusion module, a batch normalization layer and an activation function layer;
on the basis of S101, the step aims to train the one-dimensional convolution residual error neural network according to training data to obtain a decision model; wherein, the one-dimensional convolution residual error neural network includes: the system comprises a one-dimensional convolution network layer, a data fusion module, a batch normalization layer and an activation function layer. That is, training data is used for corresponding network training to determine a model for making a decision, i.e., a decision model.
Further, the step may include:
and (3) training the one-dimensional convolution residual error neural network by adopting an Adam optimizer and training data to obtain a decision model.
It can be seen that the present alternative scheme mainly explains how to perform the training of the decision model. In the alternative scheme, an Adam optimizer and training data are mainly adopted to train the one-dimensional convolution residual error neural network to obtain a decision model. Among them, the Adam optimizer (adaptive moment estimation optimizer) is a method of calculating an adaptive learning rate of each parameter.
S103, processing the received state information by adopting a decision model to obtain brand data;
on the basis of S102, the step aims to process the received state information by adopting a decision-making model to obtain brand data. Namely, the decision model trained in the previous step is adopted for application so as to make a decision of the current card game and obtain card type data. The application mode may be any one of the application modes provided in the prior art, and details are not described herein.
The process of obtaining the card type data may be calculating the winning probability of each possible initial card type data. Then, the initial card type data with the maximum winning probability can be selected as the card type data, the initial card type data with the medium winning probability can be selected as the card type data, and the initial card type data with the minimum winning probability can be selected as the card type data.
Further, the step may include:
step 1, acquiring status information from a whipped egg game server;
step 2, processing the state information by adopting a decision model to obtain initial card type data;
step 3, judging whether the initial card type data contains the card type combined with the same floriation; the same-pattern order combination is obtained by combining and arranging the game state dictionary;
step 4, if yes, card type combination is carried out from card types except the card type combined in the same suit according to the initial card type data to obtain card type data;
and 5, if not, taking the initial card type data as card type data.
It can be seen that the alternative scheme mainly explains how card type data is acquired. In this alternative, the status information is obtained from the whipped egg game server. Wherein, the status information is a text log sent by the whipped egg server. Then, processing the state information by adopting a decision model to obtain initial card type data; finally, judging whether the initial card type data contains the card type combined with the same floriation; the same-pattern order combination is obtained by combining and arranging the game state dictionary; if so, carrying out card type combination from card types except the card type combined in the same suit according to the initial card type data to obtain card type data; if not, the initial card type data is used as the card type data. Therefore, through the judgment process in the alternative scheme, the card types related to the same suit can be prevented from being played in the card playing process, and the winning card probability is improved.
Further, the step may include:
processing the received state information by adopting a decision model to obtain the winning probability of each initial card type data;
and taking the initial card type data with the maximum winning probability as the card type data.
Therefore, the alternative scheme mainly explains how to acquire the card type data. In the alternative scheme, the decision-making model is adopted to process the received state information to obtain the winning probability of each initial card type data; and taking the initial card type data with the maximum winning probability as the card type data. That is, the winning probability of each possible initial card type data is calculated by the decision model, and then the card type data with the highest probability is used as the card type data.
And S104, sending the card type data.
On the basis of S103, this step is intended to transmit the card type data so as to perform a corresponding card-drawing operation according to the card type data.
Further, the step may include:
and sending the card type data through an http interface.
In summary, in the embodiment, the training data extracted from the text log and the game state dictionary is used for obtaining the decision model after neural network training, and finally, the card playing decision is carried out according to the decision model and the received state information, so that card type data is obtained, instead of automatic card playing by using a rule model, so that more anthropomorphic robot playing operation is realized in the egg whipped game server, and the game data processing effect is improved.
The method for acquiring the card type data of the whipped egg game provided by the present application is further explained by a specific example.
The process of this embodiment may include: data processing, deep learning model building, model training and model application.
The data processing is mainly conversion from text game log data to a numerical matrix which can be used for model training; the deep learning model building mainly comprises building of a deep learning model frame structure; the model training mainly comprises the training and verification tests of a deep learning model; the model application mainly packages the deep learning model into an http service interface to provide an intelligent card-playing function for the outside.
And in the data processing process, the server builds a set of game environment, continuously converts the text logs into the current game state in the game process, and stores the current game state data matrix as a CSV file. In the initial stage of the game, a game state dictionary is initialized for each player (including a user historical card-playing record, the current hand of the user, the number of hands of all players, card-playing matrixes of other players and the total residual cards of other players); in the game process, when the current player plays cards, the game states in the state dictionary are combined into a state matrix, meanwhile, the playing action type of the player is extracted and stored in a CSV file to be used as training data. Meanwhile, updating fields related to the current player in the game state dictionary and fields related to the current player in other player game dictionaries; during the game, the playing behavior log of the player is processed in a loop by loop until the game is finished.
The deep learning model building mainly comprises building a model framework for training the playing cards. In the process of the whipped egg game, human players generally arrange the playing cards into a line according to the size of the card faces, organize the input characteristics of deep learning according to a one-dimensional array, and build a deep learning model frame based on one-dimensional convolution, wherein the deep learning model frame is consistent with the natural playing characteristics of the whipped egg game. The embodiment builds a deep learning model of a one-dimensional convolution residual error neural network architecture based on the characteristics of the whipped egg game. The structure of the residual block in the residual network of this embodiment includes: conv1D, 3Conv1D, 5Conv1D, 7Conv1D are one-dimensional convolution network layers with convolution kernels of 1, 3, 5, 7, respectively; concatenate is a data fusion module along the channel direction. In the embodiment, 4 convolution kernels with different scales are used in each residual block to extract data features with different scales, and then the features with different scales are fused to better extract the data features. Wherein, the framework of the deep learning model comprises: input is the Input layer, Resnet Block is the residual Block, Flatten is the feature expansion layer, Dense is the fully-connected neural network layer, and softmax is the normalization layer.
The model training adopts an optimizer of Adam, and the number of optimized iterations is 30. The initial learning step size is 0.001, the learning step size is adjusted to 0.0001 at the 15 th iteration, and the learning step size is adjusted to 0.00001 at the 23 th iteration.
The model application builds an http (HyperText Transfer Protocol) service interface, the service interface is responsible for receiving various state information (initial cards of players, cards played by players, outgoing players and game completion) of games from a game server, converting the state information of the games into numerical characteristic matrixes, the deep learning model reads the numerical characteristic matrixes of the games and outputs the card types which should be played by the current player in the current round, then a dictionary of the same-pattern order cards and the corresponding playing cards which can be combined are combined from the hands of the current player, if the card types recommended by the model are the same-pattern order, the corresponding playing cards are directly taken from the dictionary, if the card types recommended by the model are different-pattern order cards, the card types to be played are combined from the rest cards, and if the rest cards are not enough to form the corresponding card types, the corresponding playing cards in the same-pattern order are taken from the same-pattern order cards. Finally, the http interface returns the card type to be played and the corresponding card to the game server.
Therefore, in the embodiment, the training data extracted from the text log and the game state dictionary is used for carrying out the decision model obtained after neural network training, and finally, the card playing decision is carried out according to the decision model and the received state information, so that card type data is obtained, rather than automatic card playing by using a rule model, and therefore more anthropomorphic robot chess playing operation is realized in the whipped egg game server, and the game data processing effect is improved.
The following describes the card type data acquisition device provided in the embodiment of the present application, and the card type data acquisition device described below and the card type data acquisition method described above may be referred to in correspondence with each other.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a card-type data acquisition device for a whipped egg game provided in an embodiment of the present application.
In this embodiment, the apparatus may include:
a trainingdata acquisition module 100, configured to perform integration processing according to the acquired text log and the game state dictionary to obtain training data; the game state dictionary is dictionary data acquired when the whipped egg game is initialized;
themodel training module 200 is used for training the one-dimensional convolution residual error neural network according to the training data to obtain a decision model; wherein, the one-dimensional convolution residual error neural network includes: the system comprises a one-dimensional convolution network layer, a data fusion module, a batch normalization layer and an activation function layer;
a decisionmodel using module 300, configured to process the received state information by using a decision model to obtain brand data;
and a card typedata transmitting module 400 for transmitting card type data.
Optionally, the trainingdata obtaining module 100 may include:
a text log obtaining unit for obtaining a text log from the whipped egg game server;
the game state acquisition unit is used for converting the text log data into a game state according to the whipped egg game rule model;
and the merging unit is used for storing and merging the game state and the game state dictionary in a CSV file format to obtain training data.
An embodiment of the present application further provides a server, including:
a memory for storing a computer program;
a processor for implementing the steps of the card type data acquisition method for the whipped egg game as described in the above embodiment when the computer program is executed.
Embodiments of the present application also provide a computer-readable storage medium having stored thereon a computer program, which, when being executed by a processor, implements the steps of the card type data acquisition method for the whipped egg game as described in the above embodiments.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The card type data acquisition method, the card type data acquisition device, the server and the computer-readable storage medium of the whipped egg game provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.