🔐 Combination Lock FSM

A Moore Machine — output depends only on current state

State Diagram

S0 LOCKED S1 LOCKED S2 LOCKED S3 UNLOCKED 1 2 3 other other 1 other 1 any
FSM Type: Moore Machine
In a Moore machine, the output depends only on the current state, not on the input. Notice how each state has a fixed output label (LOCKED or UNLOCKED).

Input

_ _ _
🔒 LOCKED
Secret code: 1-2-3
Current State
S0 — Waiting for first digit. Enter '1' to begin.
State Meaning Output
S0 Initial / 0 correct LOCKED
S1 Got '1' LOCKED
S2 Got '1-2' LOCKED
S3 Got '1-2-3' ✓ UNLOCKED

Transition Log

System ready. Enter code: 1-2-3