turing_machine
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{chains,fit,shapes}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
%\tikzstyle{every path}=[very thick]
\tikzset{
rightflat/.style={
thick,
append after command={%
\pgfextra
(\tikzlastnode.south east) -| (\tikzlastnode.west) |- (\tikzlastnode.north) [sharp corners] -| cycle;
\draw (\tikzlastnode.south east) -| (\tikzlastnode.west) |- (\tikzlastnode.north east);
\endpgfextra}}
}
\edef\sizetape{0.7cm}
\tikzstyle{tmtape}=[draw, minimum size=\sizetape]
\tikzstyle{tmhead}=[arrow box,draw=red, minimum size=.5cm,arrow box
arrows={east:.18cm, west:0.18cm}, arrow box tip angle=120, arrow box shaft width=.2cm]
%% Draw TM tape
\begin{scope}[start chain=1 going right,node distance=-0.2mm]
\node [on chain=1,tmtape] {$\$$};
\node [on chain=1,tmtape] (input) {b};
\node [on chain=1,tmtape] {b};
\node [on chain=1,tmtape] {a};
\node [on chain=1,tmtape] {a};
\node [on chain=1,tmtape] {a};
\node [on chain=1,tmtape] {$\#$};
\node [on chain=1,tmtape] {$\#$};
\node [on chain=1, rightflat, minimum size=0.672cm] {};
\node [on chain=1, node distance=-0.6mm, draw=none] at (5.6,0) {$\ldots$};
\node [on chain=1] {Cinta};
\end{scope}
%% Draw TM Finite Control
\begin{scope}
[shift={(3cm,-5cm)},start chain=circle placed {at=(-\tikzchaincount*60:1)}]
\foreach \i in {q_0,q_1,q_2,q_3,\ddots,q_n}
\node [on chain] {$\i$};
% Arrow to current state
\node (center) {};
\draw[->, > = latex] (center) -- (circle-2);
\node[draw=black,thick,fit=(circle-1) (circle-2) (circle-3)
(circle-4) (circle-5) (circle-6),
label=below:Control finit] (fsbox)
{};
\end{scope}
%% Draw TM head below (input) tape cell
\node [tmhead,yshift=-.3cm] at (input.south) (head) {$q_1$};
%% Link Finite Control with Head
\path[->, > = latex, draw] (fsbox.north) .. controls (4.5,-1) and (0,-2) .. node[right]
(headlinetext)
{}
(head.south);
\node[xshift=0.5cm] at (headlinetext)
{\begin{tabular}{c}
Punter \\
\textbf{}
\end{tabular}};
\end{tikzpicture}
\end{document}