Zoom
tree
svg code
dot code

          

Transitions

Transitions, or edges, are the core of a state machine. Most states are implicitly declared by being in a transition.

On -> Off;
A one-directional transition from a state called On to a state called Off
On => Off;
A main path transition
On ~> Off;
A forced only transition
On <-> Off;
Two one-directional transitions, one from On to Off, and one from Off to On
On <=~> Off;
Two one-directional transitions, one forced-only from On to Off, and one main path from Off to On
Red -> Green -> Yellow -> Red;
Writing in chains, for density and readability
"Just today" -> "Tomorrow's list";
Using quote marks to include characters (in this case spaces and an apostrophe) which would not otherwise be legal in a name

Actions

Actions, or events, allow the state machine to handle things through the machine structure rather than functional behavior.

On 'toggle' -> Off;
A statement that, when in the On state, the toggle action will cause a switch to the Off state
On 'toggle' -> Off 'toggle' -> On;
A toggle action which changes the state both ways between Off and On as appropriate
Red 'proceed' -> Green 'proceed' -> Yellow 'proceed' -> Red;
A proceed action which cycles through a traffic light's colors automatically

Spread

Spread is a convenient way to write multiple similar edges at once.

Warrior -> [Barbarian Ranger Paladin];
Three transitions, one each from the state Warrior to the states Barbarian, Ranger, and Paladin
[Red Yellow Green] ~> Off;
Three forced transitions, one each from the states Red, Yellow, and Green to the state Off
[Asleep Awake Frightened] -> [Asleep Awake Frightened];
Nine transitions, one each from the states Asleep, Awake, and Frightened to each other, including potentially themselves

Machine Attributes

The machine itself has some attributes.

machine_name: "Example";
Sets the name of the machine. Used by the search and generation machinery.
machine_author: "Bob <who@whom.example.com>";
The author of the machine. Does not require an email format; takes a string or a list of strings.
machine_author: "Bob <who@whom.example.com>";
The author of the machine. Does not require an email format; takes a string or a list of strings.