Since generators can take initial values and expose a next
method which can run updates on the initial value, it becomes trivial to make a state machine with a generator where you pass your transitions into the next
method. This lesson walks through creating a state machine with a generator.