Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/icon-themes/colibre_svg/cmd/   (LibreOffice Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 879 B image not shown  

Bilddatei

turingmaschine-schoening-p83.cob


products/Sources/formale Sprachen/Cobol/verschiedene-Autoren/Jens/turingmaschine-schoening-p83.cob

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 0right else if head=1 then move 1 to state perform 1right else if head=3 then move 1 to state perform bleft when state=1 if head=0 then move 2 to state perform 1left else if head=1 then move 1 to state perform 0left else if head=3 then move 3 to state when state=2 if head=0 then move 2 to state perform 0left else if head=1 then move 2 to state perform 1left 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. 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.