Long before Machine Learning was all the rage in AI, there were Finite State Machines, and Hierarchical Finite State Machines, Behavior Trees, and Behavior Trees of Hierarchical State Machines and, and...
These are still used in games and Unreal Engine so let's read up and add a dash of Regex.
Finite State Machines (FSMs) are a popular and simple software pattern to manage and change states (or saved events).
Artificial Intelligence state loops often use FSMs. Above is a simple series of states to manage a virtual tiger. A non-specific diagram for games would be sense[hunt] -> think[eat] -> react[preen] -> idle[sleep] -> loop.
Regular Expressions are a series of events performed on a character String. The epsilon character (ε), represents an optional state change.
Operation Codes are String references to states for a machine or its Central Processing Unit (CPU). Above charts the Escape (Esc) sequence states of Op Codes.
When dealing with a multitude of states you may switch to Hierarchical State Machines (HSMs or Statecharts). An HSM has a superstate that links to substates, limiting the initial scope of complexity. They can be nested FSMs from a general to specialized form the lower you go. Or they can be flat so the primary factor is reusing transitional data.
Another option is Behavior Trees (BTs) which like HSMs, also have parallel states and concurrent events. They can be combined in the same system with FSMs utilized to swap trees. Essentially BTs are a tree of events traversed down from the root node. More complex actions can be created by synching multiple trees.
Like this post? Read more from the ^AI topic.