home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / TURING.ZIP / TURING.DOC < prev    next >
Text File  |  1990-06-23  |  31KB  |  598 lines

  1.                                                       Turing Machine
  2.                                                          Simulator
  3.  
  4.                                                             for
  5.  
  6.                                                            OS/2
  7.  
  8.  
  9.  
  10.                                                             by
  11.  
  12.                                                         Bert Casper
  13.  
  14.  
  15.                                                          May, 1990
  16. Table of Contents
  17.  
  18.  
  19.  
  20. 1. Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  1
  21.  
  22. 2. User's Guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  1
  23.   2.1 Program Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  1
  24.   2.2 Input File Syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  25.            2.2.1 The Value Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  26.            2.2.2 Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  27.            2.2.3 Some Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  28.  
  29. 3. How the Program Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  30.   3.1 Compilation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  31.   3.2 Program Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  32.  
  33. 1. Overview
  34.  
  35. The program described in this document simulates various different types of Turing machines in
  36. OS/2's graphical environment. It reads specification input files and then checks whether or not user
  37. provided input is accepted by the specified Turing machine.
  38.   The program can simulate the following types of Turing machines,
  39.  
  40.                    Standard (single, half infinite tape, single track, no memory, no subroutines).
  41.                    Up to two memory registers in the Turing machine.
  42.                    Up to four tracks on the tape.
  43.                    Turing machine subroutines.
  44.                    Moves are either left, right or stationary.
  45.                    Variables in transaction specifications are supported.
  46.  
  47.   The program will run on any OS/2 compatible machine, and requires no special graphic adapters.
  48. It has no memory requirements beyond those for OS/2. It is compatible with OS/2, versions 1.1,
  49. 1.2 and above, both standard and extended editions.
  50.   All source code for the simulator was written in C. Chapter 3 describes the source code and how
  51. to compile and link it on a standard OS/2 workstation.
  52.  
  53.  
  54. 2. User's Guide
  55.  
  56. The program's name is TURING.EXE, and it is started from either a full-screen or windowed OS/2
  57. command prompt, by typing: START TURING. This will always open a graphical window under
  58. the Presentation Manager for the program.
  59.   Note that it may be necessary to start several copies of the program to use certain of its functions
  60. (see below).
  61.  
  62.  
  63. 2.1 Program Syntax
  64.  
  65. The program has a menu bar with the following entries: File, Input, Speed, Start, Step, Initialize
  66. and Stop. To exit the program, use the pull down menu icon in the top-left-hand corner.
  67.  
  68. File:      Clicking this function will pop up a dialogue box, which prompts for a file name. The
  69.            default is ON1N.TUR. Enter the file name for the Turing machine specification which
  70.            you wish to run and click the OK button. Note that the program will search for the file
  71.            only on the current directory. Enter a directory path if the file is not in the current
  72.            directory. Click the CANCEL button if you wish to cancel this operation.
  73.              After the OK button is clicked, the program will automatically load the specification
  74.            (or give you an error message if it cannot do so), and initialize the machine to run.
  75.  
  76. Input:     Clicking this function will pop up a dialogue box, which prompts for input to the tracks
  77.            of the Turing machine's tape. Enter the number of the track you want to provide input
  78.            for in the first field and then press <TAB> to switch to the second field. Note that the
  79.            cursor will automatically jump to the end of this second input field, which may not be
  80.            visible in the dialogue box. To bring the cursor to the beginning of the entry field, press
  81.            <HOME>. Now enter your input string. You may edit this input string by using the
  82.            standard keyboard editing functions.
  83.              After the input is correct, click the OK button. The machine will display the input on
  84.            the tape. Note that it is impossible to provide input for more than one track at once. To
  85.            provide input for several tracks, use the input function repeatedly.
  86.  
  87. Speed:     Clicking this function will pop up a dialogue box, which prompts for the delay which
  88.            is to be applied between successive Turing machine transactions. The default is 300 ms.
  89.            The minimum delay is 0 and the maximum delay is practically unlimited. All delays are
  90.            given in milliseconds. The delay is useful for having the Turing machine execute quickly
  91.            if it is just to be determined if a specified string is accepted or not, and having the
  92.            machine execute slowly if its exact operation is to be studied.
  93.  
  94. Start:     Click this function to start execution of the Turing machine. You can restart the Turing
  95.            machine with this function if you stopped it at any time before it finished execution.
  96.  
  97. Initialize:Clicking this function will set all machine parameters, like the positioning of the head,
  98.            and the current state, to their defaults, as provided by the specification file. This function
  99.            is useful if a machine is to be run more than once with the same input.
  100.  
  101. Step:      This function allows a stepwise execution of the Turing machine. It can only be used
  102.            after the machine has been started, using the START function, described above. To use
  103.            the STEP function, start the execution of the machine, using the START function and
  104.            then stop it immediately using the STOP function described below. You can make sure
  105.            that it executes no more than one step by increasing the machine's delay time, as
  106.            specified by using the SPEED function. Now click the STEP function every time you
  107.            wish the machine to proceed to execute the next transaction. You can restart the machine
  108.            at any time, causing it to execute automatically, by clicking the START function.
  109.  
  110. Stop:      This function will stop the execution of a Turing machine immediately. The machine can
  111.            be restarted by using the START function. It can also be executed stepwise by using the
  112.            STEP function.
  113.  
  114.   If the Turing machine accepts an input string, it will play a few happy notes, and if it does not
  115. accept it, it will 'grunt'. Note that it is possible for the machine to execute forever, in which case
  116. the string is not accepted. Usually this is easily seen. In this case you have to stop the machine
  117. manually, by using the STOP function, described above.
  118.   Inside the head of the machine, the simulator always displays the current state of the Turing
  119. machine, which is P, followed by a number, 0 or greater. Below the state the simulator shows
  120. either one or two boxes in the head of the machine, which represent the memory registers of the
  121. Turing machine. The simulator will always display the current contents of these registers inside the
  122. boxes.
  123.   At the bottom left-hand corner of the screen, the simulator displays the current position of the
  124. head on the tape (the first position is 1). It also displays the total number of moves or transactions
  125. which the head or machine has gone through while reading and processing the current input. In a
  126. box at the bottom center of the screen, the simulator displays the name of the Turing machine, as
  127. provided in the input file syntax specification (see below).
  128. 2.2 Input File Syntax
  129.  
  130. The TMS accepts standard ASCII files, created with any ASCII editor, which have the general
  131. format given in text box 1. Some notes of caution about the file format,
  132.  
  133.                     -         The file may not contain any special codes or symbols, which a word
  134.                               processor, like for example WordPerfect inserts into documents to
  135.                               paginate them.
  136.                     -         The only white character the file may contain is a blank. There may
  137.                               be no TABS or so-called white ASCII symbols (symbols which appear
  138.                               to be a blank on a standard text screen) in it.
  139.                     -         The maximum file size is currently 5000 bytes. This number is totally
  140.                               arbitrary.
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.   To better understand the input file syntax, it is a good idea to look at how the program reads the
  161. file. From the program's point of view the file has 5 fields,
  162.  
  163.            (1)      The first field contains non-blank characters which make up words that are
  164.                     helpful descriptions to the user. The standard words used in the input file are
  165.                     given in text box 1. The first descriptive word is TRACKS. It identifies to the
  166.                     user that the number that follows is the number of tracks of the input tape. None
  167.                     of these words is fixed. The user can substitute whatever he wishes. However,
  168.                     the order is important and must be strictly obeyed.
  169.  
  170.            (2)      The second field is a variable number of blanks. There must be at least one
  171.                     blank in this field. This field serves only for readability, to offset the actual
  172.                     values from the descriptive words.
  173.  
  174.            (3)      The third field is a value, or a number of values, as described below.
  175.  
  176.            (4)      The fourth field only applies to the transactions at the end of the file. It is the
  177.                     field containing the '=', for the delta-function assignments. It may contain a
  178.                     variable number of blanks before the '=' and a variable number of blanks after
  179.                     the '='. There must be at least one blank before and one blank after the '='.
  180.  
  181.            (5)      The fifth field is the second transaction value, as described below.
  182.  
  183.  
  184.  
  185. 2.2.1 The Value Fields
  186.  
  187. The value fields contain the actual information which makes up the Turing Machine. They are fields
  188. three and five. Symbols for these values are used in text box 1, and these symbols will be
  189. described in detail below,
  190.  
  191.   string (NAME)               The string is a series of ASCII characters with ASCII values 30 or
  192.                               greater, no more than 30 in length, which identifies the Turing machine.
  193.  
  194.   t (TRACKS)                  The t can stand for a numerical value between 1 and 4 inclusive, which
  195.                               indicates the number of tracks of the Turing Machine.
  196.   s (STATES)                  The s stands for the total number of states of the Turing Machine. It
  197.                               must be greater than zero. Note that a Turing Machines with states p0,
  198.                               p1 and p2 has three states. The total number of states includes the
  199.                               initial and final states. The maximum number of states supported is 99.
  200.   m (MEMORY)                  The m stands for the number of internal memory registers which the
  201.                               Turing Machine has. This number is a value between 0 and 2 inclusive.
  202.   Σi (SIGMA)                  Stands for the ith component of the sigma set of the Turing Machine,
  203.                               i.e. the set of input symbols. The set's components are separated by
  204.                               commas.
  205.   Γi (GAMMA)                  Stands for the ith component of the gamma set of the Turing Machine,
  206.                               i.e. the set of output symbols. The set's components are separated by
  207.                               commas.
  208.   f (FINAL)                   The f stands for the number of the final state of the Turing Machine,
  209.                               i.e. the state which is to be interpreted as the final state. There can be
  210.                               no more than one final state. If a Turing Machine has three states, p0,
  211.                               p1 and p2, and the final state is p2, then the value of f is 2.
  212.   ti (TRANS)                  Stands for the various transaction values. There can be a maximum of
  213.                               15 of these values, and a minimum of 5. The 'i' can stand for the
  214.                               following,
  215.  
  216.                               1:       Input state: Has to be a valid state number (REQUIRED).
  217.                               2:       Input memory 1: Can be an element of the set gamma, or a '*'.
  218.                                        The '*' stands for 'don't care', meaning that the value of this
  219.                                        memory location does not matter. (OPTIONAL: REQUIRED
  220.                                        if MEMORY is 1 or 2).
  221.                               3:       Input memory 2: Can be an element of the set gamma, or a '*'.
  222.                                        The '*' stands for 'don't care', meaning that the value of this
  223.                                        memory location does not matter. (OPTIONAL: REQUIRED
  224.                                        if MEMORY is 2).
  225.                               4:       Input from track 1: Can be an element of the set gamma, or
  226.                                        one of the following,
  227.                                                  d =>     Has to be equal to memory location 1.
  228.                                                  e =>     Has to be equal to memory location 2.
  229.                                                  f =>     Has to be not-equal to memory location 1.
  230.                                                  g =>     Has to be not-equal to memory location 2.
  231.                                                  * =>     Don't care.
  232.                                        (REQUIRED).
  233.                               5:       Input from track 2: Identical to item 4. (OPTIONAL:
  234.                                        REQUIRED if TRACKS is 2 or greater).
  235.                               6:       Input from track 3: Identical to item 4. (OPTIONAL:
  236.                                        REQUIRED if TRACKS is 3 or greater).
  237.                               7:       Input from track 4: Identical to item 4. (OPTIONAL:
  238.                                        REQUIRED if TRACKS is 4).
  239.                               8:       Output state: Has to be a valid state number (REQUIRED).
  240.                               9:       Output memory 1: Can be an element of the set gamma, or one
  241.                                        of the following,
  242.                                                  d =>     The input from track 1 goes into memory 1.
  243.                                                  e =>     The input from track 2 goes into memory 1.
  244.                                                  f =>     The input from track 3 goes into memory 1.
  245.                                                  g =>     The input from track 4 goes into memory 1.
  246.                                                  * =>     The memory is not altered.
  247.                                        (OPTIONAL: REQUIRED if MEMORY is 1 or 2).
  248.                               10:      Output memory 2: Identical to item 9 with memory 1 replaced
  249.                                        by memory 2. (OPTIONAL: REQUIRED if MEMORY is
  250.                                        2).
  251.                               11:      Output to track 1: Can be an element of the set gamma, or one
  252.                                        of the following,
  253.                                                  d =>     Contents of memory 1 are output.
  254.                                                  e =>     Contents of memory 2 are output.
  255.                                                  f =>     Input from track 2 is output.
  256.                                                  g =>     Input from track 3 is output.
  257.                                                  h =>     Input from track 4 is output.
  258.                                                  * =>     Input from track 1 is output.
  259.                                        (REQUIRED).
  260.                               12:      Output to track 2: Can be an element of the set gamma, or one
  261.                                        of the following,
  262.                                                  d =>     Contents of memory 1 are output.
  263.                                                  e =>     Contents of memory 2 are output.
  264.                                                  f =>     Input from track 1 is output.
  265.                                                  g =>     Input from track 3 is output.
  266.                                                  h =>     Input from track 4 is output.
  267.                                                  * =>     Input from track 2 is output.
  268.                                        (OPTIONAL: REQUIRED if TRACKS is 2 or greater).
  269.                               13:      Output to track 3: Can be an element of the set gamma, or one
  270.                                        of the following,
  271.                                                  d =>     Contents of memory 1 are output.
  272.                                                  e =>     Contents of memory 2 are output.
  273.                                                  f =>     Input from track 1 is output.
  274.                                                  g =>     Input from track 2 is output.
  275.                                                  h =>     Input from track 4 is output.
  276.                                                  * =>     Input from track 3 is output.
  277.                                        (OPTIONAL: REQUIRED if TRACKS is 3 or greater).
  278.                               14:      Output to track 4: Can be an element of the set gamma, or one
  279.                                        of the following,
  280.                                                  d =>     Contents of memory 1 are output.
  281.                                                  e =>     Contents of memory 2 are output.
  282.                                                  f =>     Input from track 1 is output.
  283.                                                  g =>     Input from track 2 is output.
  284.                                                  h =>     Input from track 3 is output.
  285.                                                  * =>     Input from track 4 is output.
  286.                                        (OPTIONAL: REQUIRED if TRACKS is 4).
  287.                               15:      Direction of move: Can be one of the following,
  288.                                                  R =>     Head moves right.
  289.                                                  L =>     Head moves left.
  290.                                                  S => Head remains stationary.
  291.                                        (REQUIRED).
  292.  
  293.  
  294.   The Turing machine may include as many transactions as desired (to the maximum size of the
  295. file). The transactions may be of two types, as shown in text box 1. The first, or standard type
  296. specifies the state transition and new values for memory and or tracks which the turing machine
  297. is to go to when it reaches a certain state and reads a certain input. The second type is used to
  298. specify that a subroutine is to be called. The right hand side then has the special form shown in
  299. text box 1:
  300.  
  301.                                              [C:state:string]
  302.  
  303.   The C is just an identifier (which could stand for Call). The state is the state which the
  304. subroutine call is to return to, and the string is a file name for a Turing machine specification,
  305. which the program uses to define the subroutine, which has to be a Turing machine.
  306.  
  307.  
  308. 2.2.2 Subroutines
  309.  
  310. The Turing machine simulator can simulator Turing machine subroutines. This is implemented in
  311. the following way,
  312.  
  313.                    All tapes of the main machine are copied to the sub-machine. The sub-machine
  314.                     does not have to make use of all of them.
  315.                    The current position of the main machine is where the sub-machine starts
  316.                     execution. For the sub-machine this is the beginning of the tape. It cannot alter
  317.                     anything that is on the tape to the left of this position.
  318.                    If the sub-routine fails, the input is not accepted.
  319.                    If the sub-routine accepts the input it returns the result, meaning all tracks it
  320.                     altered, plus its current position to the main machine. The main machine
  321.                     continues execution from that position and with the altered input data.
  322.  
  323.   The syntax for using a subroutine is specified in section 2.2.1. Note that the main machine is
  324. always responsible for presenting the sub-machine with an input tape it will accept, from the
  325. position it is at when it makes the call, onward.
  326.   Theoretically there is no limit to the depth of nesting which can be used. I.e. a subroutine can
  327. call a subroutine, can call a subroutine, etc. Practically this is not of much use, since a standard
  328. screen cannot display very many turing machine windows in such a way that the user can still see
  329. what the simulator is doing.
  330.  
  331.  
  332. 2.2.3 Some Examples
  333.  
  334. Example 1:          The text box below shows the specification for the very simple Turing machine,
  335.                     called Zero=One (the file name is ON1N.TUR).
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.                       This Turing machine checks whether or not the number of zeros in the input
  362.                     equals the number of ones. It requires no memory, and only one track. It does
  363.                     not call any subroutines. Note that no use is made of variables in the
  364.                     transactions.
  365.  
  366. Example 2:          The text box below shows the specification for a Turing machine which reverses
  367.                     the input. Technically the input has to consist of elements of the set sigma, but
  368.                     since the specification uses variables, it will accept any input and reverse it.
  369.                       The Turing machine requires two memory registers and makes much use of
  370.                     variables in order to keep down the number of transactions which have to be
  371.                     specified in the specification. The machine uses only one track, and no
  372.                     subroutines.
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410. Example 3:          The following Turing machine is an example of a multi-track machine. It uses
  411.                     two tracks and accepts strings of the form wcw, and uses the second track for
  412.                     checking off symbols. It requires one memory register to remember the symbols
  413.                     it compares. The machine also makes use of various variables to reduce the
  414.                     number of transactions required in the specification.
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444. Example 4:          The following Turing machine is an example of a machine which calls a
  445.                     subroutine. The main machine is shown in text box 5 and the subroutine is
  446.                     shown in text box 6. The whole machine will multiply two numbers given in
  447.                     unary format (i.e. 000100 will return 000000).
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482. 3. How the Program Works
  483.  
  484. 3.1 Compilation
  485.  
  486. The Turing machine simulator program listing is given in the appendix. It has two compilation
  487. units, called TURING.C and TURING2.C. To compile the simulator, the following files are
  488. required,
  489.  
  490.                     - TURING.C
  491.                     - TURING2.C
  492.                     - TURING.H
  493.                     - TURING.RC
  494.                     - TURING.DEF
  495.  
  496.   Either the IBM C compiler 1.1, or the Microsoft C compiler version 5.1 or higher are needed to
  497. compile the program. The program must be compiled in OS/2 protected mode. Also needed are the
  498. resource compiler and the include files and library files which are part of the OS/2 Programmer's
  499. Toolbox, available from both IBM and Microsoft.
  500.   To compile and link the program, proceed as follows,
  501.  
  502.   (1)      Compile the two compilation units of the simulator, by executing the following command-
  503.            line commands,
  504.  
  505.                     cl -c -Alfw -G2sw -Gt -W3 turing.c
  506.                     cl -c -Alfw -G2sw -Gt -W3 turing2.c
  507.  
  508.            Note that case is important for the compiler and must strictly be observed. This implies
  509.            that the 'A' must be capital, as must the 'G' and the 'W', while all other characters must
  510.            be lowercase. The program names are not case-sensitive.
  511.  
  512.   (2)      Next link the compilation units to the necessary libraries to produce an executable file,
  513.            by executing the following command,
  514.  
  515.                     link turing turing2, /align:16, NUL, os2, turing
  516.  
  517.            Again, this is case-sensitive.
  518.  
  519.   (3)      The final step in the compilation process is to compile the resource file (TURING.RC)
  520.            and link it to the already existing executable file (TURING.EXE). Note: If this step is
  521.            omitted, the program will not work! Use the following command line command,
  522.  
  523.                     rc turing
  524.  
  525.            This is not case-sensitive.
  526.  
  527.   To make the compilation process easier, a batch file, called TURMAKE.CMD exists, which will
  528. do all the above. No make-file is included, since the make-file formats of IBM's C and Microsoft's
  529. C are different.
  530.  
  531.  
  532. 3.2 Program Structure
  533.  
  534. The program has standard OS/2 Presentation Manager structure. The MAIN routine does nothing
  535. but create a queue and manage it. The ClientWndProc is responsible for correspondence with the
  536. Presentation Manager. There are three dialogue procedures, called FileDlgProc and InputDlgProc,
  537. and SpeedDlgProc which handle user input. All other functions are called from the ClientWndProc
  538. and are custom functions of the simulator. What they do is explained in detail below.
  539.  
  540.   main              Creates and then manages the program's queue. Destroys this queue when the
  541.                     program is exited. (located in TURING.C, lines 38-61).
  542.  
  543.   ClientWndProc     Basically consists of a large SWITCH procedure which handles those incoming
  544.                     messages which are of interest to the simulator. Most of these messages involve
  545.                     OS/2 specific handling, and a treatment of this goes beyond the scope of this
  546.                     document. (located in TURING.C, lines 64-334).
  547.  
  548.   FileDlgProc       Creates a dialogue box which is displayed when the user wishes to change the
  549.                     input file name. The user input is then returned to the program. (located in
  550.                     TURING2.C, lines 662-683).
  551.  
  552.   InputDlgProc      Creates a dialogue box which is displayed when the user wishes to change the
  553.                     input of the tape. The user specifies to which track he wishes to give input and
  554.                     then specifies the input itself. (located in TURING2.C, lines 606-635).
  555.  
  556.   SpeedDlgProc      Creates a dialogue box which is displayed when the user wishes to change the
  557.                     speed with which the simulator executes. The user specifies a delay which is
  558.                     applied between successive transactions. This delay can can be from 0 to 65536
  559.                     milliseconds in length. (located in TURING2.C, lines 638-659).
  560.  
  561.   Turing            The main work-horse of the simulator. This routine is called to process a
  562.                     transaction of the Turing machine. All transactions of the current machine are
  563.                     loaded into the structure DELTA, shown on lines 20 to 28 in the listing of
  564.                     TURING2.C in the appendix, by the load routine, described below. The turing
  565.                     routine indexes this structure with the current state to determine what possible
  566.                     input and memory combinations will lead to a state change. It checks all
  567.                     possibilities, until it finds a match. The first match is always executed. If it does
  568.                     not find a match, the simulation fails, i.e. the input string is not accepted.
  569.                       If a match is found, the memory register(s) (MEMORY[]), the position of the
  570.                     head (POSITION), the tape (INPUT[][]), and the current state (STATE) are
  571.                     updated and the routine exits. If the new state is the final state, the simulator
  572.                     accepts the input string by playing a merry tune and the routine is exited.
  573.                     (located in TURING2.C, lines 41-254).
  574.  
  575.   Load              This routine is called whenever new specification data is to be loaded from a
  576.                     new specification file. The routine reads the file sequentially, skipping all valid
  577.                     blanks and descriptive words in it to read the relevant values into the various
  578.                     data structures of the program. Note that no syntax checking of any kind is
  579.                     performed. If the syntax of the file is incorrect, the results are unpredictable.
  580.                     (located in TURING2.C, lines 257-407).
  581.  
  582.   Draw_Screen       This routine draws the tape, its contents and the informational boxes at the
  583.                     bottom of the screen. (located in TURING2.C, lines 524-584).
  584.  
  585.   Draw_Machine      This routine draws the Turing machine's head and the memory registers, as well
  586.                     as the state inside it. The routine is called whenever the head moves, to redraw
  587.                     the head in its new position. (located in TURING2.C, lines 433-501).
  588.  
  589.   Erase_Machine     This routine is needed to erase the machine's head, so that it can be redrawn
  590.                     in a new position. (located in TURING2.C, lines 504-521).
  591.  
  592.   Update_Tape       This routine is used to update the input/output tape whenever the Turing machine
  593.                     writes data out to it. The routine can handle all tracks of the tape, but the track
  594.                     it should write to must be specified. (located in TURING2.C, lines 410-430).
  595.  
  596.   Initialize        This routine resets all parameters of the simulation, which allows it to be
  597.                     restarted at any point. (located in TURING2.C, lines 587-603).
  598.