identification division .
program-id . turing is common initial .
author . "JD" .
date-written . 25 .10 .2004 .
date-compiled .
data division .
working-storage section .
77 card pic 9 (4 ) value 3 .
77 leftband pic 9 (16 ) value 0 .
77 head pic 9 (1 ).
77 state pic 9 (16 ).
88 startstate value 0 .
77 endstate pic 9 (16 ).
88 value 3 .
linkage section .
77 rightband pic 9 (16 ).
procedure division using reference rightband.
**********************************************
*simuliert eine Turing Maschine
* Bandalphabet als Integer mit Kardinalität card
* Eingbealphabet als Integer mit Kardinalität card
* rechtes Band als Integer mit Basis card(Alphabet)
* linkes Band als Integer mit Basis card(Alphabet)
* Zustand als Integer
**********************************************
display "start"
* check rightband for input alphabet obmitted
set startstate to true
perform until (state=endstate)
compute head=function mod(rightband,card)
evaluate true
when state=0
if head=0 then move 0 to state perform 0 right
else if head=1 then move 1 to state perform 1 right
else if head=3 then move 1 to state perform bleft
when state=1
if head=0 then move 2 to state perform 1 left
else if head=1 then move 1 to state perform 0 left
else if head=3 then move 3 to state
when state=2
if head=0 then move 2 to state perform 0 left
else if head=1 then move 2 to state perform 1 left
else if head=3 then move 3 to state perform bright
when state=endstate
display "ende, Leftband=" leftband" Rightband=" rightband
end-evaluate
end-perform .
goback .
0 left .
compute leftband=leftband/card
compute rightband=rightband*card
1 left .
compute leftband=leftband/card
compute rightband=rightband*card+1
bleft.
compute leftband=leftband/card
compute rightband=rightband*card+2
0 right .
compute leftband=leftband*card
compute rightband=rightband/card
1 right .
compute leftband=leftband*card
compute rightband=rightband/card+1
bright.
compute leftband=leftband*card
compute rightband=rightband/card+2
end-program turing.
Messung V0.5 in Prozent C=87 H=100 G=93
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-08)
¤
*© Formatika GbR, Deutschland