File:3tape-turing-machine.svg

Summary

Description
English: 3 tape-turing-machine

Created using the tikz package and compiled with pdflatex.

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{ifthen}
\usepackage{tikz}
\usetikzlibrary{chains}
\usetikzlibrary{calc, decorations.pathmorphing}
\tikzstyle{tape}=[thick, draw, minimum height=5mm, minimum width=7mm, fill=green!35,outer sep=0pt]
\tikzstyle{head}=[very thick, draw, minimum height=6mm, minimum width=7mm, fill=none,outer sep=0pt]

\def\DrawTape#1{
\begin{scope}[start chain=1 going right,node distance=-0.15mm]
    % start tape
    \node [on chain=1,tape,draw=none, tape, fill=none, draw=none] at (0,-\i*1) (node\i0){\ldots\ };
    \draw [thick,fill=green!35] (node\i0.north east) -- ++(-.07,0) decorate [decoration={zigzag, segment length=.10cm, amplitude=.015cm}] 
    {-- ($(node\i0.south east)+(-.15,0)$)} -- (node\i0.south east) -- cycle;
    % draw tape 
      \foreach [count=\j] \element in \adlist {     
	  \ifthenelse{\j = \head}{ % read-write heads current position
		    \node [on chain=1,tape, fill=red!35] (node\i\j){\element};
	      }
	      {
		    \node [on chain=1,tape] (node\i\j) {\element};
	      }
      }    
    % close tape
    \draw [thick,fill=green!35] (node\i\j.north east) -- ++(.15,0) decorate [decoration={zigzag, segment length=.10cm, amplitude=.015cm}] 
    {-- ($(node\i\j.south east)+(.07,0)$)} -- (node\i\j.south east) -- cycle;
    \node [on chain=1,tape, fill=none, draw=none] (end\i) {\ \ldots};
    \node [right = of end\i]{\tiny tape~\i};
    
    % draw read-write head
    \prevnode=\head
    \advance\prevnode by -1
    \node [head,right = of node\i\the\prevnode] (head\i){};
    \node [above = of head\i]{\tiny head \i};
\end{scope}
}
\newcount\prevnode
\begin{document}
% Define the turing machine as a list of pairs, where each pair consists of the read-writes head position the delimiter "/" and  the list of symbols on the tape.
\newcommand{\tapes}{ 3/{, , ,1,1, }, 1/{, 1, 0, 1 , 0,}, 2/{ , 1 , 1, 0, 1,}}
\begin{tikzpicture}
% Draw program node
\draw (-1.5,-2) node [draw, thick, rectangle, minimum height= 2.5cm, minimum width=2cm, fill=white, rounded corners] (program){program};

% Draw tapes and heads
\foreach [count=\i] \head/\adlist in \tapes {
    % Draw tape and head
    \DrawTape{\i,\head,\adlist}
    % Draw link to program
    \draw[thick, rounded corners=3pt] (program) {-- ($(node\i0.south west) + (0,-0.15)$)} 
	{-- ($(head\i.south) + (0,-0.1)$)}-- (head\i.south);
}
\end{tikzpicture}
\end{document}
Date
Source Own work
Author Wdvorak

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#3tape-turing-machine.svg
Category:Self-published work Category:Turing machines Category:English-language SVG diagrams
Category:CC-BY-SA-4.0 Category:English-language SVG diagrams Category:Self-published work Category:Turing machines