I agree that the last three lines feel strange from a real-world appliance perspective. A state machine has to distinguish between the current physical state and the previous operating state, otherwise closing the door could restore a state that no longer makes sense. The same kind of logic can apply to modern appliances such as washing machines, where the controller tracks things like door status, water level, motor state, and the selected cycle. When something goes wrong with that sequence, a washer...