State Machine Diagrams
State machine A covers player 1's interactions with the gameplay, while machine B covers player 2's interactions. Machine A is the "master" controller, dealing with information sent from Machine B and making all of the decisions. It then sends messages back to B based on the state of both A and B. State machine A also handles all of the timers and timeouts. Each state machine has two sub state machines to keep track of the state of the targets and the state of the balance boards. Machine A is inherently more complicated, as it tracks both players' states. Machine A also checks directly for the access card removal.
The main state machine A handles the movement through different stages of the game and with timeouts. The target interpreter, which is a separate and smaller state machine, keeps track of whether the active target is covered or not. It is also moderating if player 2's target is covered or uncovered based on data sent from machine B. The balance interpreter has a similar state machine as the target, simply keeping track of the state. Depending on the state of the main machine, it gives the user different feedback (turning the vibrating motor on, for instance). Timeouts and access card removals will send all substate machines back into an initialization state.
The main state machine A handles the movement through different stages of the game and with timeouts. The target interpreter, which is a separate and smaller state machine, keeps track of whether the active target is covered or not. It is also moderating if player 2's target is covered or uncovered based on data sent from machine B. The balance interpreter has a similar state machine as the target, simply keeping track of the state. Depending on the state of the main machine, it gives the user different feedback (turning the vibrating motor on, for instance). Timeouts and access card removals will send all substate machines back into an initialization state.
State machine B, seen below, is a simpler version of machine A. It keeps track of the stages of the game, but its main function is to send data about player 2 to machine A, then wait for a response telling it to move on. Machine B does not really make autonomous decisions and is considered the "slave" machine. Its substate machines are also simpler, as they only include player 2's interactions and not player 1.