
\begin{tikzpicture}[scale= 0.8, transform shape]
\onslide<1->{
                  \draw[draw=red!60,fill=green!20,thick,solid,rounded corners] (-1.2,3) rectangle (4,8.1);

                 \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (B) at (-0.5,5.5){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Bemb) at (-0.5,4){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=green!200, draw=black] (C) at (-0.5,7){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.5,3.3){\tiny $<$Go$>$};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.9,7.7){\tiny o/p:};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.5,7.7){\tiny I};
                  \draw[->](Bemb)--(B);
                  \draw[->](B)--(C);
                  \draw[-](-0.65,3.7)--(-0.35,3.7);
                  \draw[-](-0.65,3.9)--(-0.35,3.9);
                  \draw[-](-0.65,4.1)--(-0.35,4.1);
                  \draw[-](-0.65,4.3)--(-0.35,4.3);
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.5,3.6){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.5,3.8){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.5,4){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.5,4.2){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.5,4.4){\tiny 1};
                  \draw[-](-0.65,6.7)--(-0.35,6.7);
                  \draw[-](-0.65,6.9)--(-0.35,6.9);
                  \draw[-](-0.65,7.1)--(-0.35,7.1);
                  \draw[-](-0.65,7.3)--(-0.35,7.3);
            \filldraw[color=black] (-0.65,6.9) rectangle (-0.35,7.1);
            %\draw [->] plot coordinates {(3,1.4) (3,1.75) (-1,1.75) (-1, 5.5)  (-0.7,5.5)};
                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (B1) at (0.5,5.5){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Bemb1) at (0.5,4){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=green!200, draw=black] (C1) at (0.5,7){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0.5,3.3){\tiny I};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0.5,7.7){\tiny am};
                  \draw[->](Bemb1)--(B1);
                  \draw[->](B)--(B1);
                  \draw[->](B1)--(C1);

                  \draw[-](0.35,3.7)--(0.65,3.7);
                  \draw[-](0.35,3.9)--(0.65,3.9);
                  \draw[-](0.35,4.1)--(0.65,4.1);
                  \draw[-](0.35,4.3)--(0.65,4.3);
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0.5,3.6){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0.5,3.8){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0.5,4){\tiny 1};
                  \node [rectangle, minimum height=3mm, minimum width=      3mm,text width=1cm, align=center] (w1) at (0.5,4.2){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0.5,4.4){\tiny 0};
                  \draw[-](0.35,6.7)--(0.65,6.7);
                  \draw[-](0.35,6.9)--(0.65,6.9);
                  \draw[-](0.35,7.1)--(0.65,7.1);
                  \draw[-](0.35,7.3)--(0.65,7.3);
            \filldraw[color=black] (0.35,6.7) rectangle (0.65,6.9);
                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (B2) at (1.5,5.5){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Bemb2) at (1.5,4){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=green!200, draw=black] (C2) at (1.5,7){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,3.3){\tiny am};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,7.7){\tiny going};    
                  \draw[->](Bemb2)--(B2);
                  \draw[->](B2)--(C2);
                  \draw[->](B1)--(B2);

                  \draw[-](1.35,3.7)--(1.65,3.7);
                  \draw[-](1.35,3.9)--(1.65,3.9);
                  \draw[-](1.35,4.1)--(1.65,4.1);
                  \draw[-](1.35,4.3)--(1.65,4.3);
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,3.6){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,3.8){\tiny 1};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,4){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,4.2){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,4.4){\tiny 0};
                  \draw[-](1.35,6.7)--(1.65,6.7);
                  \draw[-](1.35,6.9)--(1.65,6.9);
                  \draw[-](1.35,7.1)--(1.65,7.1);
                  \draw[-](1.35,7.3)--(1.65,7.3);
            \filldraw[color=black] (1.35,7.3) rectangle (1.65,7.5);
                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (B3) at (2.5,5.5){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Bemb3) at (2.5,4){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=green!200, draw=black] (C3) at (2.5,7){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.5,3.3){\tiny going};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.5,7.7){\tiny home};
                  \draw[->](Bemb3)--(B3);
                  \draw[->](B3)--(C3);
                  \draw[->](B2)--(B3);

                  \draw[-](2.35,3.7)--(2.65,3.7);
                  \draw[-](2.35,3.9)--(2.65,3.9);
                  \draw[-](2.35,4.1)--(2.65,4.1);
                  \draw[-](2.35,4.3)--(2.65,4.3);
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.5,3.6){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.5,3.8){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.5,4){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.5,4.2){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.5,4.4){\tiny 1};
                  \draw[-](2.35,6.7)--(2.65,6.7);
                  \draw[-](2.35,6.9)--(2.65,6.9);
                  \draw[-](2.35,7.1)--(2.65,7.1);
                  \draw[-](2.35,7.3)--(2.65,7.3);
                      \filldraw[color=black] (2.35,7.1) rectangle (2.65,7.3);

                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (B4) at (3.5,5.5){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Bemb4) at (3.5,4){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=green!200, draw=black] (C4) at (3.5,7){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.5,3.3){\tiny home};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=2cm, align=center] (w1) at (3.5,7.7){\tiny $<$STOP$>$};
                  \draw[->](Bemb4)--(B4);
                  \draw[->](B4)--(C4);
                  \draw[->](B3)--(B4);

                  \draw[-](3.35,3.7)--(3.65,3.7);
                  \draw[-](3.35,3.9)--(3.65,3.9);
                  \draw[-](3.35,4.1)--(3.65,4.1);
                  \draw[-](3.35,4.3)--(3.65,4.3);
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.5,3.6){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.5,3.8){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.5,4){\tiny 0};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.5,4.2){\tiny 1};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.5,4.4){\tiny 0};
                  \draw[-](3.35,6.7)--(3.65,6.7);
                  \draw[-](3.35,6.9)--(3.65,6.9);
                  \draw[-](3.35,7.1)--(3.65,7.1);
                  \draw[-](3.35,7.3)--(3.65,7.3);
            \filldraw[color=black] (3.35,7.1) rectangle (3.65,7.3);
   


\draw[draw=red!60,fill=red!20,thick,solid,rounded corners] (-0.6-0,-1.4) rectangle (4.5-0,1.5);
                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (A) at (0-0,1){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Aemb) at (0-0,-0.5){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.3-0,-0.5){\tiny $x_1$};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0-0,-1.2){\tiny Main};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (-0.3-0.2,-1.2){\tiny i/p:};
                  \draw[->](Aemb)--(A);
                  
                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (A1) at (1-0,1){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Aemb1) at (1-0,-0.5){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0.7-0,-0.5){\tiny $x_2$};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1-0,-1.2){\tiny ghar};
                  \draw[->](Aemb1)--(A1);
                  \draw[->](A)--(A1);

                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (A2) at (2-0,1){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Aemb2) at (2-0,-0.5){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.7-0,-0.5){\tiny $x_3$};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2-0,-1.2){\tiny ja};
                  \draw[->](Aemb2)--(A2);
                  \draw[->](A1)--(A2);

                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (A3) at (3-0,1){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Aemb3) at (3-0,-0.5){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.7-0,-0.5){\tiny $x_4$};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3-0,-1.2){\tiny raha};

                  \draw[->](Aemb3)--(A3);
                  \draw[->](A2)--(A3);
      

                  \node [rectangle, minimum height=8mm, minimum width=3mm, fill=blue!50, draw=black] (A4) at (4-0,1){};
                  \node [rectangle, minimum height=10mm, minimum width=3mm, fill=orange!50, draw=black] (Aemb4) at (4-0,-0.5){};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (4.7-0,-0.5){\tiny $x_5$};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (4-0,-1.2){\tiny hoon};
                  \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (4.3-0,1){\tiny $h_i$};
                  \draw[->](Aemb4)--(A4);
                  \draw[->](A3)--(A4);

      

      }
\onslide<3>{
                         \node[circle, minimum width=0.15mm, align=center, draw=black] (M) at (1.5-0,2.5){\tiny $+$};
                
            

            \draw [->,dashed, color=blue] plot coordinates {(0.75-0,5.5) (1-0,5.5) (1-0,2.5) (1.2-0,2.5)};
            \draw [->, dashed, color=blue] plot coordinates {(1.8-0,2.5) (2-0,2.5) (2-0,4.6) (1.8-0,4.6) (1.6-0,4.6) (1.6-0,5)};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2.2,2.5){\tiny $c_3$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0,1.8){\tiny $\alpha_{1,3}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1,1.8){\tiny $\alpha_{2,3}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2,1.8){\tiny $\alpha_{3,3}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3,1.8){\tiny $\alpha_{4,3}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (4,1.8){\tiny $\alpha_{5,3}$};
                  \draw[->](A) -- (M);
                   \draw[->](A1) --(M);
                   \draw[->](A2) -- (M);
                   \draw[->](A3) -- (M);
                   \draw[->](A4) -- (M);

}
\onslide<2>{
      
                   \node[circle, minimum width=0.15mm, align=center, draw=black] (M) at (1.5-1,2.5){\tiny $+$};
                
      
            \draw [->,dashed, color=blue] plot coordinates {(0.75-1,5.5) (1-1,5.5) (1-1,2.5) (1.2-1,2.5)};
            \draw [->, dashed, color=blue] plot coordinates {(1.8-1,2.5) (2-1,2.5) (2-1,4.6) (1.8-1,4.6) (1.6-1,4.6) (1.6-1,5)};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.2,2.5){\tiny $c_2$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0,1.8){\tiny $\alpha_{1,2}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1,1.8){\tiny $\alpha_{2,2}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2-0.5,1.8){\tiny $\alpha_{3,2}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3-1,1.8){\tiny $\alpha_{4,2}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (4-1,1.8){\tiny $\alpha_{5,2}$};

                  \draw[->](A) -- (M);
                   \draw[->](A1) --(M);
                   \draw[->](A2) -- (M);
                   \draw[->](A3) -- (M);
                   \draw[->] (A4) -- (M);

}      



\onslide<4>{
      
                   \node[circle, minimum width=0.15mm, align=center, draw=black] (M) at (1.5+1,2.5){\tiny $+$};
                
            
      
            \draw [->,dashed, color=blue] plot coordinates {(0.75+1,5.5) (1+1,5.5) (1+1,2.5) (1.2+1,2.5)};
            \draw [->, dashed, color=blue] plot coordinates {(1.8+1,2.5) (2+1,2.5) (2+1,4.6) (1.8+1,4.6) (1.6+1,4.6)(1.6+1,5)};


            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0+1,1.8){\tiny $\alpha_{1,4}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5,1.8){\tiny $\alpha_{2,4}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2,1.8){\tiny $\alpha_{3,4}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3,1.8){\tiny $\alpha_{4,4}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (4,1.8){\tiny $\alpha_{5,4}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.2,2.5){\tiny $c_4$};
                  \draw[->](A) -- (M);
                   \draw[->](A1) --(M);
                   \draw[->](A2) -- (M);
                   \draw[->](A3) -- (M);
                  \draw[->](A4)--(M);
}


\onslide<5>{
      
                   \node[circle, minimum width=0.15mm, align=center, draw=black] (M) at (1.5+2,2.5){\tiny $+$};
                
            
      
            \draw [->,dashed, color=blue] plot coordinates {(0.75+2,5.5) (1+2,5.5) (1+2,2.5) (1.2+2,2.5)};
            \draw [->, dashed, color=blue] plot coordinates {(1.8+2,2.5) (2+2,2.5) (2+2,4.6) (1.8+2,4.6) (1.6+2,4.6)(1.6+2,5)};


            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (0+1,1.8){\tiny $\alpha_{1,5}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (1.5+1,1.8){\tiny $\alpha_{2,5}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (2+1,1.8){\tiny $\alpha_{3,5}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3+0.5,1.8){\tiny $\alpha_{4,5}$};


            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (4+0.5,1.8){\tiny $\alpha_{5,5}$};

            \node [rectangle, minimum height=3mm, minimum width=3mm,text width=1cm, align=center] (w1) at (3.2+1,2.5){\tiny $c_5$};
                  \draw[->](A) -- (M);
                   \draw[->](A1) --(M);
                   \draw[->](A2) -- (M);
                   \draw[->](A3) -- (M);
                   \draw[->] (A4) -- (M);

}           

	%	\draw [->, color=red] plot coordinates {(-0.7,5.5) (+1,5.5) (-1,1.75) (3,1.75) (3,1.4) };
	
	
\end{tikzpicture}
