New answers tagged


The ovals are the 'states' in the finite state machine.


Your question is a bit light on specific context. One particular distinction here is if your A-state machine and B-state machine can be abstracted into a common ancestor, the base-state machine. Specifically, are you able to abstract all of the state machine features that A and B use, so that the logic for A using its AStateMachine is exactly the same as B ...


One way, focusing on the light and button. Viewing the power system as a separate concern. | current State | event | new State | |---------------|--------------|-----------| | Unpowered | press button | Unpowered | | Unpowered | powered | Off | | Off | press button | On | | Off | unpowered | Unpowered | ...


In a finite state machine with no push down stack, all state is encoded in... the states. You have several different dimensions I can identify: Battery state: depleted/charging/charged Plgged-in state: unplugged/plugged Device state: on/off You can imagine a 3D chart that has one cell for every possible comination of battery state, plugged-in state and ...

Top 50 recent answers are included