Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/turmul.log
There are 2 other files named turmul.log in the archive. Click here to see a list.
100'  NAME--TURMUL
110'
120'  DESCRIPTION--SUMULATES THE ACTION OF A TURING MACHINE. A
130'  TURING MACHINE IS A SET OF QUADRUPLES (Q,S,O,Q') WHERE
140'        Q  IS THE NUMBER OF THE STATE OF THE MACHINE
150'        S  IS A SYMBOL FROM THE ALPHABET 0,1,2
160'        O  IS AN OPERATION CODE:  0   WRITE 0
170'                                      1   WRITE 1
180'                                      2   WRITE 2
190'                                      3   MOVE TAPE LEFT ONE SQUARE
200'                                      4   MOVE TAPE RIGHT ONE SQUARE
210'        Q' IS ALSO THE NUMBER OF A "STATE" OF THE MACHINE
220'  A TURING MACHINE OPERATES AS FOLLOWS: THE MACHINE STARTS IN 
230'  STATE 1 SCANNING THE LEFTMOST NONBLANK SQUARE OF THE TAPE (THE
240'  SYMBOL 0 IS REGARDED AS A BLANK). AT EACH STEP IN THE COMPUTATION
250'  THE ACTION OF THE MACHINE IS DETERMINED BY THE CURRENT
260'  STATE Q OF THE MACHINE AND THE SYMBOL S WRITTEN ON THE SQUARE
270'  OF THE TAPE CURRENTLY BEING SCANNED. THE MACHINE PERFORMS
280'  THE OPERATION O INDICATED BY THE QUADRUPLE WHOSE FIRST TWO
290'  COMPONENTS ARE Q AND S, AND THEN CHANGES ITS INTERNAL STATE
300'  TO Q'. COMPUTATION HALTS WHEN STATE 0 IS REACHED.
310'
320'  SOURCE--UNKNOWN
330'
340'  INSTRUCTIONS--THE USER MUST SPECIFY THE INTERNAL CONFIGURATIONS OF
350'  THE TURING MACHINE, THE INITIAL TAPE CONFIGURATION, AND THE
360'  MAXIMUM NUMBER OF STEPS OF COMPUTATION TO BE PERFORMED,
370'  AS FOLLOWS:
380'    1150 DATA N ( A NUMBER <100 INDICATING THE TOTAL NUMBER OF
390'                 STATES IN THE MACHINE)
400'    1160 DATA X10,X11,X12,........,XN0,XN1,XN2
410'             (N*3 NUMBERS CODING THE QUADRUPLES FOR STATES 1
420'              THROUGH N: XQS SHOULD BE 10*Q'+0)
430'    1170 DATA -1
440'    1180 DATA T (THE NUMBER OF SYMBOLS IN THE TAPE)
450'    1190 DATA T1,....,TT  (THE SYMBOLS ON THE TAPE)
460'    1200 DATA -1
470'    1210 DATA C THE MAXIMUM NUMBER OF STEPS TO BE DONE)
480'
490'  UPON BEING RUN THE PROGRAM WILL SIMULATE THE ACTION OF THE
500'  TURING MACHINE DESCRIBED, PERFORMING UP TO C STEPS IN
510'  THE COMPUTATION OF THE MACHINE (OF COURSE, IF STATE 0 IS REACHED
520'  BEFORE C STEPS HAVE OCCURRED, COMPUTAION WILL HALT). THE
530'  FINAL TAPE CONFIGUARATION WILL BE PRINTED OUT.
540'
550'
560'  *  *  *  *  *  *  *  MAIN PROGRAM  *  *  *  *  *  *  *  *  *  *
570'
580 DIM C(100,2), T(400)
590 READ S9
600 FOR S = 1 TO S9
610 FOR M = 0 TO 2
620 READ C(S,M)
630 NEXT M
640 NEXT S
650 READ F
660 IF F = -1 THEN 690
670 PRINT "DATA ERROR"
680 STOP
690 READ N
700 FOR I = 0 TO 400
710 LET T(I) = 0
720 NEXT I
730 FOR I = 200 TO 199+N
740 READ T(I)
750 NEXT I
760 READ F
770 IF F <>-1 THEN 670
780 READ T
790 LET S = 1
800 LET I = 200
810 FOR N1 = 1 TO T
820 LET M = T(I)
830 LET X = C(S,M)
840 LET S = INT(X/10)
850 LET R = X-10*S
860 IF R > 2 THEN 890
870 LET T(I) = R
880 GOTO 970
890 IF R > 3 THEN 920
900 LET I = I+1
910 GOTO 970
920 IF R > 4 THEN 950
930 LET I = I-1
940 GOTO 970
950 PRINT "INSTRUCTION ERROR"
960 STOP
970 IF S = 0 THEN 1000
980 NEXT N1
990 PRINT "TIME IS UP"
1000 FOR I1 = 0 TO 400
1010 IF T(I1)>0 THEN 1050
1020 NEXT I1
1030 PRINT "BLANK TAPE"
1040 STOP
1050 FOR I2 = 400 TO 0 STEP -1
1060 IF T(I2)>0 THEN 1080
1070 NEXT I2
1080 REM  PRINT TAPE
1090 FOR I = I1 TO I2
1100 PRINT T(I);
1110 NEXT I
1120 PRINT
1130 PRINT
1140 PRINT N1 "STEPS"
1150 DATA 2
1160 DATA 20,13,22,21,4,21
1170 DATA -1
1180 DATA 10
1190 DATA 1,1,1,1,1,1,1,1,0,2
1200 DATA -1
1210 DATA 100
1220 END