Technique · engine
State machine
A number that names what a game or an object is doing now, with one routine per value and a dispatch that runs the current one.
A state machine keeps a number for what something is doing and runs the routine for that number. Changing the number changes the behavior from the next frame. Games use one for their overall flow and others for each player and enemy, usually through a jump table.