Quelle turingmaschine-schoening-p83.cob
Sprache: Cobol
identificationdivision. program-id. turing iscommoninitial. author. "JD". date-written. 25.10.2004. date-compiled. datadivision. working-storagesection.
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. linkagesection.
77 rightband pic 9(16). proceduredivisionusingreference 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 totrue performuntil (state=endstate) compute head=function mod(rightband,card) evaluatetrue when state=0 if head=0 thenmove 0 to state perform 0right elseif head=1 thenmove 1 to state perform 1right elseif head=3 thenmove 1 to state perform bleft when state=1 if head=0 thenmove 2 to state perform 1left elseif head=1 thenmove 1 to state perform 0left elseif head=3 thenmove 3 to state when state=2 if head=0 thenmove 2 to state perform 0left elseif head=1 thenmove 2 to state perform 1left elseif head=3 thenmove 3 to state perform bright when state=endstate display"ende, Leftband="leftband" Rightband="rightband end-evaluate end-perform. goback.
0left. compute leftband=leftband/card compute rightband=rightband*card
1left. compute leftband=leftband/card compute rightband=rightband*card+1
bleft. compute leftband=leftband/card compute rightband=rightband*card+2
0right. compute leftband=leftband*card compute rightband=rightband/card
1right. 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
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.