The Alan Turing Internet Scrapbook


Turing Machines implemented in JavaScript

Alan Turing Home Page | Site Map | Scrapbook Index | Previous Scrapbook page | Next Scrapbook page



Turing machines implemented in JavaScript

Here you can see the basic ideas of Turing machines illustrated by some very simple examples. Continue to the Scrapbook page on Alan Turing and his Turing machines for more general information on the machine concept.

CLICK on one of these:
The tape will appear here. The scanned square, marked off with |||....|||, remains fixed while the tape passes through it.
Current state number
Current tape position
Current step number

What to do:

First choose your machine by CLICKing on the selection.
Then click on LOAD.
Now you can choose STEP to make the machine take one step at a time, or RUN to let the machine run until it terminates the calculation.
You can interrupt a RUN with BREAK. To resume, click on CONTINUE and then either STEP or RUN.
Reset by using LOAD.

The machines:

Machine 1 is there to illustrate the basic operations. Step through the moves to see how it 'adds' two groups of 1's into a single group.

Machine 2 performs a divisibility test: the machine will stop with an X printed in the original blank square separating the numbers if and only if the number on the left divides exactly into the number on the right. It is illustrated here for 3 and 6.

Machine 3 uses this divisibility test as the basis for a primality test: the machine stops with an X in the original square if and only if the number on the right is prime. It is illustrated here with the number 5 (this takes 489 steps).

© Andrew Hodges, 1 January 2003

The Turing machine table of behaviour
will appear below, set out in quintuples:

state | read | write | move | next-state






CONTINUE: Next Page | Previous Page | Scrapbook Index

Quick Links: book Short Bio scrapbook philosophy publications sources
home
Andrew Hodges