In automata theory, there are two basic types of finite state machines (FSM). One of those is called Moore machine , named after its inventor Edward Moore. Moore machines consist of states and transitions. States are able to produce outputs, and the output is determined solely by the current state, not by any input. Modeled as a Moore machine the ferry example looks like the following:
Ferry example as a Moore machine, modeled with YAKINDU Statechart Tools
The state diagram has four states: NorthernPort, SouthernPort, Northwards and Southwards. Each of these states produces an output which is an action of the ferry. The ferry can either stop when one of the two ports is reached ( ferry.stop) or move from one port to another ( ferry.moveSouthwards and ferry.moveNorthwards). In Moore machines the output only relies on the current state. This means that the output will not change unless the state also changes. This happens when a transition is taken. In our example, we have two kinds of inputs that may trigger a state transition: The ship’s mate who can decide where to sail (e.g. mate.sailSouthwards) and the quay which can detect an arriving ferry (e.g. quay.reachedSouthernBank).