91
state machine
Explicit states and the only legal transitions. Idle can go to run. Dead cannot go to jump.
What is state machine?
A finite state machine is a set of states and allowed edges. Events trigger transitions. Each state owns enter, update, and exit. A pile of booleans (`isJumping && !isDead && isAngry`) is not a machine.
Why does state machine matter when vibe coding?
Models add booleans. Combinations explode and an impossible pose ships. Name the states and the forbidden edges.
How do you do state machine?
List states. List events. Write the table. Illegal events no-op. On transition, exit the old and enter the new. Animations key off the state, not off a parallel boolean.
How do you ask a model for state machine?
Model (actor) as a state machine: (states). Only these transitions: (edges). Illegal events do nothing. Do not use a pile of booleans.
What goes wrong with state machine?
A machine that any state can reach any other “for flexibility.” Then you do not have a machine. You have a suggestion.