Question: Draw state machine for a combination lock. The combination is 1-4-2. If you get any digit wrong, you should go back to the initial state.
Draw state machine for a combination lock. The combination is 1-4-2. If you get any digit wrong, you should go back to the initial state. (6 points) (Assume there are only numbers 1-5 on your lock)
Sol83:
Here is the state machine diagram for the combination lock:
+--1--+
| |
[Initial]--[1]--[2]--[3]--[4]--[Success]
| |
+---------[Reset]----+
The states are represented by the circles, and the transitions are represented by the arrows. The numbers next to the arrows represent the digits of the combination. The [Initial] state is the starting point, and the [Success] state is the end point when the correct combination has been entered.
If the correct digit is entered, the state machine moves to the next digit. If an incorrect digit is entered, the state machine goes back to the [Initial] state. If the [Reset] transition is taken, the state machine also goes back to the [Initial] state.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
