In the previous post in this series, we linked two state machines together, weakly, by arranging to press their Start buttons at the same time and to press their Next buttons at the same time. As a result, we got a contraption that could crank out the following number pairs:
To make this happen, the state of the state machine consists of a pair of numbers. As in previous posts, those components of the state are given a name – here exponent and power. If you follow what happens with the exponent component of the state, you see that it is set to 0 when the start button is pressed, and that one is added to it each time the next button is pressed. Similarly, the power component starts at 1 and is doubled each time the next button is pressed. This is consistent with the two state machines in the previous post, and is consistent with the table of number pairs that we are trying to generate. As you can see, the core operations of the state machine are relatively simple: +1 and × 2; most of the details of the state machine have to do with keeping track of what is being done to what, and what triggers what is done when.