Predicting actions with an N-Gram predictor

Predicting actions is a great way to give players a challenge by going from random selection to selection based on past actions. One way to implement machine learning is by using probabilities to predict what the player will do next, and that's what an N-Gram predictor does.

To predict the player's next choice, N-Gram predictors hold a record of the probabilities of making particular decisions (which are usually moves), given all the combinations of the choices for the previous n moves.

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.