Update to
Alan Turing: the Enigma

by Andrew Hodges

Turing machines implemented in JavaScript

This page is part of the update material for Chapter 2 of Alan Turing: The Enigma.

Alan Turing: the Enigma

Alan Turing Home Page
Site Map | Contact and FAQ




Here you can see the basic ideas of Turing machines illustrated by some very simple examples.

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



A more extensive version of this simulator is available on Paul Rendell's site.



Quick Links: book publications sources scrapbook
home
Andrew Hodges