Turing Simulator

There are lots of very useful Turing Machine simulators out there to practice with in a computational theory class. I just wanted to add mine to the mix! What is nice about it?

  • Supports multiple tapes
  • Can simulate any Turing Machine
  • Written in simple and well documented Java
  • Supports wildcard transitions on tapes to keep machines simpler
  • Comes with an example on how to convert infix to postfix, and reverse 01 strings

Here is an example of a turing machine description for the simulator

 

% A 2-tape Turing Machine that reverses input. The first tape is the input
% and the second is the output. The alphabet is 0,1 and both tapes start
% careful, input for this must be in the form '#011011'
% with #. @author Alex Knaust
2
#
#
2
0 0 0X 0X RS
0 0 1X 1X RS
0 0 ## ## RR
0 1 _X _X LS

1 1 0_ 00 LR
1 1 1_ 11 LR
1 A #X #X SS

And the output you would get by running it with the string ‘#110

user@Shiki-nix:/media/data/Projects/workspace/TuringSimulator/src$ java TuringSimulator Reverse.tm '#110'
CONT : #|q0|110_
#|q0|_

CONT : #1|q0|10_
#|q0|_

CONT : #11|q0|0_
#|q0|_

CONT : #110|q0|_
#|q0|_

CONT : #11|q1|0_
#|q1|_

CONT : #1|q1|10_
#0|q1|_

CONT : #|q1|110_
#01|q1|_

CONT : |q1|#110_
#011|q1|_

ACCEPT : |A|#110_
#011|A|_

 

The source, along with examples and a detailed description of how to create your own descriptions is downloadable here.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Alex Knaust's homepage(s)