Question 4. Imagine a scenario where your room has two buttons (B1 and B2) that control
3 lights in the room. By default, the state is: 'OFF'. When you press any of those 2 buttons,
the room's main light (M) turns on ('M' state). In the 'M' state, if you press button B1, the
room's main light turns off and the bed light (B) turns on ('B' state). But if you are in 'M'
state and press button B2, the room's main light turns off and the study lamp(S) turns on('S'
state). If you are in either states 'S' or 'B', pressing any of the two buttons, results in turning
off the lights and transitioning to the 'OFF' state.
'M'
B1
B2
'S'
B1 or B2
'B'
B1 or B2
'OFF'
B1 or B2
Question 4A. Carefully evaluate the Finite State machine diagram above that explains this
scenario and complete the state table below, the 1st entry in the state table is added for your
reference. (10 points)
State
Input
Output State
OFF B1 Pressed
M
OFF B2 Pressed
M
M B1 Pressed
M B2 Pressed
B B1 Pressed
B B2 Pressed
S B1 Pressed
S B2 Pressed
Question 4B. Starting from the 'B' state, find an input pattern with the minimum number of
button presses to make the study lamp on ('S' state). (5 points)