State machine to identify three consecutive heads

Explain a finite state machine which will detect three consecutive coins tosses of one coin which results in heads?

E

Expert

Verified

State machine to identify three consecutive heads appearing within multiple tosses;

State 1: initial state
So long as the toss results within TAIL, in this state when the toss results in HEAD go to state 2.

State 2: HEAD1 resulted within the next toss; when TAIL is resulted go to the initial state1.
When HEAD is resulted go to state3.

state3: HEAD2 is resulted in the next toss; when TAIL is resulted go to the initial state1.
When HEAD is resulted go to state4.

state4: HEAD3 is resulted and it is the last state
So long as the HEAD results in each next toss be in state 4. When any toss results in TAIL go to initial state1.

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.