Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
#=====================================
# Turing Machine (C++ Implementation)
# --> [Version 1.0]
# Alex Vinokur
# http://up.to/alexvn
# alexvn@go.to, alexv@hitechclub.com
#-------------------------------------
# MINGW
# GNU gcc version 3.2.0
#-------------------------------------
# START
# Sat Nov 09 17:58:27 2002
#=====================================
---> YOUR COMMAND LINE : turing
USAGE : turing [ metafile-name : Default = metafile.txt ]
: turing [ -h|--help|? ]
EXAMPLES : turing
: turing abcd.txt
: turing -h
: turing --help
: turing ?
-----------------------
--- File metafile.txt
-----------------------
Row# 1 ---> 2 states1.txt alphabt1.txt rules1.txt input11.txt input12.txt input13.txt
Row# 2 ---> 5 XXX YYY ZZZ UUU WWW VVV SSS
-----------------------
========== Data selected from Metafile metafile.txt ==========
---------- Turing Machine# 1 ----------
Number of tapes : 2
States file name : states1.txt
Alphabet file name : alphabt1.txt
Transitions file name : rules1.txt
Input words files names : input11.txt input12.txt input13.txt
---------- Turing Machine# 2 ----------
Number of tapes : 5
States file name : XXX
Alphabet file name : YYY
Transitions file name : ZZZ
Input words files names : UUU WWW VVV SSS
########## Turing Machine# 1 : BEGIN ##########
%%===========================================
%%============ Turing Machine# 1 ============
%%=== PreProcessing Metafile Data : BEGIN ===
%%===========================================
-----------------------
--- File states1.txt
-----------------------
Row#1 ---> q0
Row#2 ---> q5
Row#3 ---> q1 q2 q3 q4
-----------------------
Initial state : q0
Halting state : q5
Internal states : q1 q2 q3 q4
-----------------------
--- File alphabt1.txt
-----------------------
Row#1 ---> b
Row#2 ---> x
Row#3 ---> 0 1
-----------------------
Empty state : b
Internal symbols : x
Input symbols : 0 1
-----------------------
--- File rules1.txt
-----------------------
Row#1 ---> q0 0 b q1 0 N x R
Row#2 ---> q0 1 b q1 1 N x R
Row#3 ---> q0 b b q5 b N b N
Row#4 ---> q1 0 b q1 0 R 0 R
Row#5 ---> q1 1 b q1 1 R 1 R
Row#6 ---> q1 b b q2 b N b L
Row#7 ---> q2 b 0 q2 b N 0 L
Row#8 ---> q2 b 1 q2 b N 1 L
Row#9 ---> q2 b x q3 b L x R
Row#10 ---> q3 0 0 q4 0 N 0 R
Row#11 ---> q3 1 1 q4 1 N 1 R
Row#12 ---> q4 0 0 q3 0 L 0 N
Row#13 ---> q4 0 1 q3 0 L 1 N
Row#14 ---> q4 1 0 q3 1 L 0 N
Row#15 ---> q4 1 1 q3 1 L 1 N
Row#16 ---> q4 0 b q5 0 N b N
Row#17 ---> q4 1 b q5 1 N b N
-----------------------
Rule : q0 0 b q1 0 N x R
Rule : q0 1 b q1 1 N x R
Rule : q0 b b q5 b N b N
Rule : q1 0 b q1 0 R 0 R
Rule : q1 1 b q1 1 R 1 R
Rule : q1 b b q2 b N b L
Rule : q2 b 0 q2 b N 0 L
Rule : q2 b 1 q2 b N 1 L
Rule : q2 b x q3 b L x R
Rule : q3 0 0 q4 0 N 0 R
Rule : q3 1 1 q4 1 N 1 R
Rule : q4 0 0 q3 0 L 0 N
Rule : q4 0 1 q3 0 L 1 N
Rule : q4 1 0 q3 1 L 0 N
Rule : q4 1 1 q3 1 L 1 N
Rule : q4 0 b q5 0 N b N
Rule : q4 1 b q5 1 N b N
-----------------------
--- File input11.txt
-----------------------
Row#1 ---> 0 1 0
Row#2 ---> b
-----------------------
-----------------------
--- File input12.txt
-----------------------
Row#1 ---> 0 0 1
Row#2 ---> b
-----------------------
-----------------------
--- File input13.txt
-----------------------
Row#1 ---> 0 1 1 1 1 0
Row#2 ---> b
-----------------------
Input words --> Set#1
Tape#0 : 0 1 0
Tape#1 : b
Input words --> Set#2
Tape#0 : 0 0 1
Tape#1 : b
Input words --> Set#3
Tape#0 : 0 1 1 1 1 0
Tape#1 : b
%%===========================================
%%=== PreProcessing Metafile Data : END ===
%%============ Turing Machine# 1 ============
%%===========================================
%%===========================================
%%============ Turing Machine# 1 ============
%%======= Machine Definition : BEGIN ========
%%===========================================
###### Turing Machine Definition ######
====== States Definition ======
Initial states : q0
Halting states : q5
Internal states : q1 q2 q3 q4
====== Alphabet Definition ======
------ Tape# 0 ------
Empty symbols alphabet : b
Input alphabet : 0 1
Internal alphabet : x
------ Tape# 1 ------
Empty symbols alphabet : b
Input alphabet : 0 1
Internal alphabet : x
====== Transition Rules Definition ======
Rule# 0 : q0 [ 0 b ] ---> q1 [ (0, N) (x, R) ]
Rule# 1 : q0 [ 1 b ] ---> q1 [ (1, N) (x, R) ]
Rule# 2 : q0 [ b b ] ---> q5 [ (b, N) (b, N) ]
Rule# 3 : q1 [ 0 b ] ---> q1 [ (0, R) (0, R) ]
Rule# 4 : q1 [ 1 b ] ---> q1 [ (1, R) (1, R) ]
Rule# 5 : q1 [ b b ] ---> q2 [ (b, N) (b, L) ]
Rule# 6 : q2 [ b 0 ] ---> q2 [ (b, N) (0, L) ]
Rule# 7 : q2 [ b 1 ] ---> q2 [ (b, N) (1, L) ]
Rule# 8 : q2 [ b x ] ---> q3 [ (b, L) (x, R) ]
Rule# 9 : q3 [ 0 0 ] ---> q4 [ (0, N) (0, R) ]
Rule# 10 : q3 [ 1 1 ] ---> q4 [ (1, N) (1, R) ]
Rule# 11 : q4 [ 0 0 ] ---> q3 [ (0, L) (0, N) ]
Rule# 12 : q4 [ 0 1 ] ---> q3 [ (0, L) (1, N) ]
Rule# 13 : q4 [ 0 b ] ---> q5 [ (0, N) (b, N) ]
Rule# 14 : q4 [ 1 0 ] ---> q3 [ (1, L) (0, N) ]
Rule# 15 : q4 [ 1 1 ] ---> q3 [ (1, L) (1, N) ]
Rule# 16 : q4 [ 1 b ] ---> q5 [ (1, N) (b, N) ]
%%===========================================
%%======= Machine Definition : END ========
%%============ Turing Machine# 1 ============
%%===========================================
%%===========================================
%%============ Turing Machine# 1 ============
%%========= Processing Input Words =========
%%============= Set# 1 : BEGIN ==============
%%===========================================
###### Input words on tape(s) ######
Tape#0 : 0 1 0
Tape#1 : b
###### Processing ######
----- Initial status -----
State : q0
Tape#0 : [0] 1 0
Tape#1 : [b]
Applied Rule# 0 : q0 [ 0 b ] ---> q1 [ (0, N) (x, R) ]
----- Status#1 -----
State : q1
Tape#0 : [0] 1 0
Tape#1 : x [b]
Applied Rule# 3 : q1 [ 0 b ] ---> q1 [ (0, R) (0, R) ]
----- Status#2 -----
State : q1
Tape#0 : 0 [1] 0
Tape#1 : x 0 [b]
Applied Rule# 4 : q1 [ 1 b ] ---> q1 [ (1, R) (1, R) ]
----- Status#3 -----
State : q1
Tape#0 : 0 1 [0]
Tape#1 : x 0 1 [b]
Applied Rule# 3 : q1 [ 0 b ] ---> q1 [ (0, R) (0, R) ]
----- Status#4 -----
State : q1
Tape#0 : 0 1 0 [b]
Tape#1 : x 0 1 0 [b]
Applied Rule# 5 : q1 [ b b ] ---> q2 [ (b, N) (b, L) ]
----- Status#5 -----
State : q2
Tape#0 : 0 1 0 [b]
Tape#1 : x 0 1 [0] b
Applied Rule# 6 : q2 [ b 0 ] ---> q2 [ (b, N) (0, L) ]
----- Status#6 -----
State : q2
Tape#0 : 0 1 0 [b]
Tape#1 : x 0 [1] 0 b
Applied Rule# 7 : q2 [ b 1 ] ---> q2 [ (b, N) (1, L) ]
----- Status#7 -----
State : q2
Tape#0 : 0 1 0 [b]
Tape#1 : x [0] 1 0 b
Applied Rule# 6 : q2 [ b 0 ] ---> q2 [ (b, N) (0, L) ]
----- Status#8 -----
State : q2
Tape#0 : 0 1 0 [b]
Tape#1 : [x] 0 1 0 b
Applied Rule# 8 : q2 [ b x ] ---> q3 [ (b, L) (x, R) ]
----- Status#9 -----
State : q3
Tape#0 : 0 1 [0] b
Tape#1 : x [0] 1 0 b
Applied Rule# 9 : q3 [ 0 0 ] ---> q4 [ (0, N) (0, R) ]
----- Status#10 -----
State : q4
Tape#0 : 0 1 [0] b
Tape#1 : x 0 [1] 0 b
Applied Rule# 12 : q4 [ 0 1 ] ---> q3 [ (0, L) (1, N) ]
----- Status#11 -----
State : q3
Tape#0 : 0 [1] 0 b
Tape#1 : x 0 [1] 0 b
Applied Rule# 10 : q3 [ 1 1 ] ---> q4 [ (1, N) (1, R) ]
----- Status#12 -----
State : q4
Tape#0 : 0 [1] 0 b
Tape#1 : x 0 1 [0] b
Applied Rule# 14 : q4 [ 1 0 ] ---> q3 [ (1, L) (0, N) ]
----- Status#13 -----
State : q3
Tape#0 : [0] 1 0 b
Tape#1 : x 0 1 [0] b
Applied Rule# 9 : q3 [ 0 0 ] ---> q4 [ (0, N) (0, R) ]
----- Status#14 -----
State : q4
Tape#0 : [0] 1 0 b
Tape#1 : x 0 1 0 [b]
Applied Rule# 13 : q4 [ 0 b ] ---> q5 [ (0, N) (b, N) ]
----- Status#15 -----
State : q5
Tape#0 : [0] 1 0 b
Tape#1 : x 0 1 0 [b]
Success : Current state is halting one
---------------------------------------
--- Result : Input word(s) ACCEPTED ---
---------------------------------------
|==================|
|--- Statistics ---|
|... Transition ...|
|------------------|
| Rules : Times |
|------------------|
| 0 : 1 |
| 1 : 0 |
| 2 : 0 |
| 3 : 2 |
| 4 : 1 |
| 5 : 1 |
| 6 : 2 |
| 7 : 1 |
| 8 : 1 |
| 9 : 2 |
| 10 : 1 |
| 11 : 0 |
| 12 : 1 |
| 13 : 1 |
| 14 : 1 |
| 15 : 0 |
| 16 : 0 |
|------------------|
| Total : 15 |
|==================|
%%===========================================
%%============= Set# 1 : END ==============
%%========= Processing Input Words =========
%%============ Turing Machine# 1 ============
%%===========================================
%%===========================================
%%============ Turing Machine# 1 ============
%%========= Processing Input Words =========
%%============= Set# 2 : BEGIN ==============
%%===========================================
###### Input words on tape(s) ######
Tape#0 : 0 0 1
Tape#1 : b
###### Processing ######
----- Initial status -----
State : q0
Tape#0 : [0] 0 1
Tape#1 : [b]
Applied Rule# 0 : q0 [ 0 b ] ---> q1 [ (0, N) (x, R) ]
----- Status#1 -----
State : q1
Tape#0 : [0] 0 1
Tape#1 : x [b]
Applied Rule# 3 : q1 [ 0 b ] ---> q1 [ (0, R) (0, R) ]
----- Status#2 -----
State : q1
Tape#0 : 0 [0] 1
Tape#1 : x 0 [b]
Applied Rule# 3 : q1 [ 0 b ] ---> q1 [ (0, R) (0, R) ]
----- Status#3 -----
State : q1
Tape#0 : 0 0 [1]
Tape#1 : x 0 0 [b]
Applied Rule# 4 : q1 [ 1 b ] ---> q1 [ (1, R) (1, R) ]
----- Status#4 -----
State : q1
Tape#0 : 0 0 1 [b]
Tape#1 : x 0 0 1 [b]
Applied Rule# 5 : q1 [ b b ] ---> q2 [ (b, N) (b, L) ]
----- Status#5 -----
State : q2
Tape#0 : 0 0 1 [b]
Tape#1 : x 0 0 [1] b
Applied Rule# 7 : q2 [ b 1 ] ---> q2 [ (b, N) (1, L) ]
----- Status#6 -----
State : q2
Tape#0 : 0 0 1 [b]
Tape#1 : x 0 [0] 1 b
Applied Rule# 6 : q2 [ b 0 ] ---> q2 [ (b, N) (0, L) ]
----- Status#7 -----
State : q2
Tape#0 : 0 0 1 [b]
Tape#1 : x [0] 0 1 b
Applied Rule# 6 : q2 [ b 0 ] ---> q2 [ (b, N) (0, L) ]
----- Status#8 -----
State : q2
Tape#0 : 0 0 1 [b]
Tape#1 : [x] 0 0 1 b
Applied Rule# 8 : q2 [ b x ] ---> q3 [ (b, L) (x, R) ]
----- Status#9 -----
State : q3
Tape#0 : 0 0 [1] b
Tape#1 : x [0] 0 1 b
Failure : 1) There exists no appropriate rule
2) Current state is not halting one
---------------------------------------
--- Result : Input word(s) REJECTED ---
---------------------------------------
|==================|
|--- Statistics ---|
|... Transition ...|
|------------------|
| Rules : Times |
|------------------|
| 0 : 1 |
| 1 : 0 |
| 2 : 0 |
| 3 : 2 |
| 4 : 1 |
| 5 : 1 |
| 6 : 2 |
| 7 : 1 |
| 8 : 1 |
| 9 : 0 |
| 10 : 0 |
| 11 : 0 |
| 12 : 0 |
| 13 : 0 |
| 14 : 0 |
| 15 : 0 |
| 16 : 0 |
|------------------|
| Total : 9 |
|==================|
%%===========================================
%%============= Set# 2 : END ==============
%%========= Processing Input Words =========
%%============ Turing Machine# 1 ============
%%===========================================
%%===========================================
%%============ Turing Machine# 1 ============
%%========= Processing Input Words =========
%%============= Set# 3 : BEGIN ==============
%%===========================================
###### Input words on tape(s) ######
Tape#0 : 0 1 1 1 1 0
Tape#1 : b
###### Processing ######
----- Initial status -----
State : q0
Tape#0 : [0] 1 1 1 1 0
Tape#1 : [b]
Applied Rule# 0 : q0 [ 0 b ] ---> q1 [ (0, N) (x, R) ]
----- Status#1 -----
State : q1
Tape#0 : [0] 1 1 1 1 0
Tape#1 : x [b]
Applied Rule# 3 : q1 [ 0 b ] ---> q1 [ (0, R) (0, R) ]
----- Status#2 -----
State : q1
Tape#0 : 0 [1] 1 1 1 0
Tape#1 : x 0 [b]
Applied Rule# 4 : q1 [ 1 b ] ---> q1 [ (1, R) (1, R) ]
----- Status#3 -----
State : q1
Tape#0 : 0 1 [1] 1 1 0
Tape#1 : x 0 1 [b]
Applied Rule# 4 : q1 [ 1 b ] ---> q1 [ (1, R) (1, R) ]
----- Status#4 -----
State : q1
Tape#0 : 0 1 1 [1] 1 0
Tape#1 : x 0 1 1 [b]
Applied Rule# 4 : q1 [ 1 b ] ---> q1 [ (1, R) (1, R) ]
----- Status#5 -----
State : q1
Tape#0 : 0 1 1 1 [1] 0
Tape#1 : x 0 1 1 1 [b]
Applied Rule# 4 : q1 [ 1 b ] ---> q1 [ (1, R) (1, R) ]
----- Status#6 -----
State : q1
Tape#0 : 0 1 1 1 1 [0]
Tape#1 : x 0 1 1 1 1 [b]
Applied Rule# 3 : q1 [ 0 b ] ---> q1 [ (0, R) (0, R) ]
----- Status#7 -----
State : q1
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : x 0 1 1 1 1 0 [b]
Applied Rule# 5 : q1 [ b b ] ---> q2 [ (b, N) (b, L) ]
----- Status#8 -----
State : q2
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : x 0 1 1 1 1 [0] b
Applied Rule# 6 : q2 [ b 0 ] ---> q2 [ (b, N) (0, L) ]
----- Status#9 -----
State : q2
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : x 0 1 1 1 [1] 0 b
Applied Rule# 7 : q2 [ b 1 ] ---> q2 [ (b, N) (1, L) ]
----- Status#10 -----
State : q2
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : x 0 1 1 [1] 1 0 b
Applied Rule# 7 : q2 [ b 1 ] ---> q2 [ (b, N) (1, L) ]
----- Status#11 -----
State : q2
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : x 0 1 [1] 1 1 0 b
Applied Rule# 7 : q2 [ b 1 ] ---> q2 [ (b, N) (1, L) ]
----- Status#12 -----
State : q2
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : x 0 [1] 1 1 1 0 b
Applied Rule# 7 : q2 [ b 1 ] ---> q2 [ (b, N) (1, L) ]
----- Status#13 -----
State : q2
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : x [0] 1 1 1 1 0 b
Applied Rule# 6 : q2 [ b 0 ] ---> q2 [ (b, N) (0, L) ]
----- Status#14 -----
State : q2
Tape#0 : 0 1 1 1 1 0 [b]
Tape#1 : [x] 0 1 1 1 1 0 b
Applied Rule# 8 : q2 [ b x ] ---> q3 [ (b, L) (x, R) ]
----- Status#15 -----
State : q3
Tape#0 : 0 1 1 1 1 [0] b
Tape#1 : x [0] 1 1 1 1 0 b
Applied Rule# 9 : q3 [ 0 0 ] ---> q4 [ (0, N) (0, R) ]
----- Status#16 -----
State : q4
Tape#0 : 0 1 1 1 1 [0] b
Tape#1 : x 0 [1] 1 1 1 0 b
Applied Rule# 12 : q4 [ 0 1 ] ---> q3 [ (0, L) (1, N) ]
----- Status#17 -----
State : q3
Tape#0 : 0 1 1 1 [1] 0 b
Tape#1 : x 0 [1] 1 1 1 0 b
Applied Rule# 10 : q3 [ 1 1 ] ---> q4 [ (1, N) (1, R) ]
----- Status#18 -----
State : q4
Tape#0 : 0 1 1 1 [1] 0 b
Tape#1 : x 0 1 [1] 1 1 0 b
Applied Rule# 15 : q4 [ 1 1 ] ---> q3 [ (1, L) (1, N) ]
----- Status#19 -----
State : q3
Tape#0 : 0 1 1 [1] 1 0 b
Tape#1 : x 0 1 [1] 1 1 0 b
Applied Rule# 10 : q3 [ 1 1 ] ---> q4 [ (1, N) (1, R) ]
----- Status#20 -----
State : q4
Tape#0 : 0 1 1 [1] 1 0 b
Tape#1 : x 0 1 1 [1] 1 0 b
Applied Rule# 15 : q4 [ 1 1 ] ---> q3 [ (1, L) (1, N) ]
----- Status#21 -----
State : q3
Tape#0 : 0 1 [1] 1 1 0 b
Tape#1 : x 0 1 1 [1] 1 0 b
Applied Rule# 10 : q3 [ 1 1 ] ---> q4 [ (1, N) (1, R) ]
----- Status#22 -----
State : q4
Tape#0 : 0 1 [1] 1 1 0 b
Tape#1 : x 0 1 1 1 [1] 0 b
Applied Rule# 15 : q4 [ 1 1 ] ---> q3 [ (1, L) (1, N) ]
----- Status#23 -----
State : q3
Tape#0 : 0 [1] 1 1 1 0 b
Tape#1 : x 0 1 1 1 [1] 0 b
Applied Rule# 10 : q3 [ 1 1 ] ---> q4 [ (1, N) (1, R) ]
----- Status#24 -----
State : q4
Tape#0 : 0 [1] 1 1 1 0 b
Tape#1 : x 0 1 1 1 1 [0] b
Applied Rule# 14 : q4 [ 1 0 ] ---> q3 [ (1, L) (0, N) ]
----- Status#25 -----
State : q3
Tape#0 : [0] 1 1 1 1 0 b
Tape#1 : x 0 1 1 1 1 [0] b
Applied Rule# 9 : q3 [ 0 0 ] ---> q4 [ (0, N) (0, R) ]
----- Status#26 -----
State : q4
Tape#0 : [0] 1 1 1 1 0 b
Tape#1 : x 0 1 1 1 1 0 [b]
Applied Rule# 13 : q4 [ 0 b ] ---> q5 [ (0, N) (b, N) ]
----- Status#27 -----
State : q5
Tape#0 : [0] 1 1 1 1 0 b
Tape#1 : x 0 1 1 1 1 0 [b]
Success : Current state is halting one
---------------------------------------
--- Result : Input word(s) ACCEPTED ---
---------------------------------------
|==================|
|--- Statistics ---|
|... Transition ...|
|------------------|
| Rules : Times |
|------------------|
| 0 : 1 |
| 1 : 0 |
| 2 : 0 |
| 3 : 2 |
| 4 : 4 |
| 5 : 1 |
| 6 : 2 |
| 7 : 4 |
| 8 : 1 |
| 9 : 2 |
| 10 : 4 |
| 11 : 0 |
| 12 : 1 |
| 13 : 1 |
| 14 : 1 |
| 15 : 3 |
| 16 : 0 |
|------------------|
| Total : 27 |
|==================|
%%===========================================
%%============= Set# 3 : END ==============
%%========= Processing Input Words =========
%%============ Turing Machine# 1 ============
%%===========================================
########## Turing Machine# 1 : END ##########
########## Turing Machine# 2 : BEGIN ##########
%%===========================================
%%============ Turing Machine# 2 ============
%%=== PreProcessing Metafile Data : BEGIN ===
%%===========================================
[ run.cpp , 458 ] FATAL ERROR : Unable to open file
[ run.cpp , 680 ] FATAL ERROR : Unable to read states file
========== States file structure ==========
Row#1 : list of initial states
Row#2 : list of halting states
Row#3 : list of internal states
===========================================
========== States file sample ==========
q0
q5
q1 q2 q3 q4
========================================
%%===========================================
%%=== PreProcessing Metafile Data : END ===
%%============ Turing Machine# 2 ============
%%===========================================
[ run.cpp , 166 ] FATAL ERROR : Can't invoke this Turing Machine
---> Invalid Data !!!
########## Turing Machine# 2 : END ##########
#=====================================
# Turing Machine (C++ Implementation)
# --> [Version 1.0]
# Alex Vinokur
# http://up.to/alexvn
# alexvn@go.to, alexv@hitechclub.com
#-------------------------------------
# MINGW
# GNU gcc version 3.2.0
#-------------------------------------
# FINISH
# Sat Nov 09 17:58:27 2002
#=====================================