Using neural network
Artificial neural networks (ANNs) are an advanced form of AI used in some games. They may not be directly used in-game; however, they may be used during the production phase to train the AI agents. Neural nets are mostly used as predictive algorithms. Based on certain parameters, and historical data, they calculate the most likely decision or attribute that the AI agent will distribute. ANNs are not restricted to games; they are used across multiple diverse domains to predict possible outcomes.
Getting ready
To work through this recipe, you will need a machine running Windows and Visual Studio.
How to do it…
Take a look at the following code snippet:
class neuralNetworkTrainer { private: //network to be trained neuralNetwork* NN; //learning parameters double learningRate; // adjusts the step size of the weight update double momentum; // improves performance of stochastic learning (don't use for batch) //epoch counter long epoch;...