How it works...

The predictor registers a set of actions according to the size of the window (the number of actions to register to make predictions) and assigns them the resulting value. For example, for a window with a size of 3, the first three are saved as a key to predict that it's possible that a fourth one may follow.

The prediction function computes how likely it is for an action to be the one that follows, given a set of previous actions. The more registered actions, the more accurate the predictor will be (with some limitations).

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.