From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 250 × 119 pixels, file size: 34 KB)


English: 3 track-turing-machine

Created using the tikz package and compiled with pdflatex.

\usetikzlibrary{calc, decorations.pathmorphing}
\tikzstyle{track}=[thick, draw, minimum height=5mm, minimum width=7mm, fill=green!35,outer sep=0pt]
\tikzstyle{head}=[very thick, draw, minimum height=6mm, minimum width=5mm, fill=none,outer sep=0pt]

\begin{scope}[start chain=1 going right,node distance=-0.15mm]
    % start track
    \node [on chain=1,track,draw=none, track, fill=none, draw=none] at (0,-\i*0.5) (node\i0){};
    \draw [fill=green!35,thick] (node\i0.north east) -- ++(.15,0) 
    {-- ($(node\i0.north east)+(-\shiftl-\rate*\i,0)$)}
    decorate [decoration={zigzag, segment length=.10cm, amplitude=.015cm}] 
    {-- ($(node\i0.south east)+(-\shiftl-\rate*\i-\rate,0)$)} -- (node\i0.south east) -- cycle;
    % draw track
      \foreach [count=\j] \element in \adlist {     
	  \ifthenelse{\j = \head}{ % read-write heads current position
		    \node [on chain=1,track, fill=red!35] (node\i\j){\element};
		    \node [on chain=1,track] (node\i\j) {\element};
    % close track
    \draw [fill=green!35, thick] (node\i\j.north east) -- ++(.15,0) 
    {-- ($(node\i\j.north east)+(\shiftr-\rate*\i,0)$)}
    decorate [decoration={zigzag, segment length=.10cm, amplitude=.015cm}] 
    {-- ($(node\i\j.south east)+(\shiftr-\rate*\i-\rate,0)$)} -- (node\i\j.south east) -- cycle;
    \node [on chain=1,track, fill=none, draw=none] (end\i) {};
    \node [right = of end\i]{\tiny track~\i};

% Define the turing machine as a list of lists of symbols on each track of the tape.
\newcommand{\tracks}{{, , ,1,1, }, {, 1, 0, 1 , 0,}, { , 1 , 1, 0, 1,}}

% parameters
\newcommand{\shiftr}{0.35} % increase for more tracks
\newcommand{\shiftl}{0.1} % increase for more tracks
% Draw program node
\draw (2.5, 1) node [draw, thick, rectangle, minimum height= 1cm, minimum width=4cm, fill=white, rounded corners] (program){program};

% Draw tracks
\foreach [count=\i] \adlist in \tracks {
    \DrawTrack{\i, \adlist}   
% Draw Head
\draw[very thick] {($(node1\head.north west)+(-0,0.07)$)} 
		  {-- ($(node1\head.north east)+(+0,0.07)$)}
		  {-- ($(node\i\head.south east)+(+0,-0.07)$)}
		  {-- ($(node\i\head.south west)+(-0,-0.07)$)}
		  -- cycle;
\draw[thick, rounded corners=3pt] (program) {-- node[right]{\tiny head} ($(node1\head.north)+(+0,0.07)$)};
Source Own work
Author Wdvorak


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 attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
  • share alike – If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.

File history

Click on a date/time to view the file as it appeared at that time.

current20:31, 2 September 2016Thumbnail for version as of 20:31, 2 September 2016250 × 119 (34 KB)Wdvorak (talk | contribs)User created page with UploadWizard
  • You cannot overwrite this file.

There are no pages that use this file.