Encrypting sequential circuit

1. Nov 25, 2011

jason1

I'm new, forgive me.
1. The problem statement, all variables and given/known data
The transmitter has one input (X) on which information bits are fed to the unit. It has one output (Z) on which the encrypted bit stream appears.
Operation:
(a) Initially the output Z is equal to the value of the input bit.
(b) After the pattern 111 occurs in the input, the output becomes equal to the complement of the input bit until the pattern 000 occurs.
(c) Once the pattern 000 occurs in the input, the output becomes equal to the input bit until the pattern 111 occurs.

(b) and (c) continue for as long as bits are received.

Example:
X = 0 1 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 0
Z = 0 1 1 0 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 0 0 1

I need to make a moore circuit using JK flip flops

2. Relevant equations

3. The attempt at a solution
I can't figure out how I'm supposed to make b and c continue for as long as bits are received....