At the forefront of Artificial Intelligence
  Home Articles Reviews Interviews JDK Glossary Features Discussion Search
Home » Articles » General » Applications/Code

The JavaScript Turing Machine

Below is the simplest of Turing Machines, one that simply adds one to a number. A number is represented as a series of 0s and 1s. It is represented in a continually stream of 1s with padding zeros around them. For example, 3 is 0011100, 8 is 001111111100. The type of representation is called unary notation. The padding zeros just make it easier for the program to add, because if there is no cell to write to, it won't create one. All we need to create f(x) = x+1 are two states, arbitarily called "State A" and "State B". These are indicated below with checkboxes, the one checked is the state the machine is in.

These are the rules for the machine:

  • If the internal state is "State A", and it reads a 0, output a zero.
  • If the internal state is "State A", and it reads a 1, change to "State B", and write a one.
  • If the internal state is "State B", and it reads a 0, change to "State A", and write a one.
  • If the internal state is "State B", and it reads a 1, output a one.
To operate the machine, press Next to advance the tape once. You can enter in your own number if you like, "1" is already in the machine, and it will recycle the output once the input tape is empty.
A Simple Turing Machine
 Input:
 
Output:
 
State A State B

Submitted: 06/01/2000

Article content copyright © James Matthews, 2000.
 Article Toolbar
Print
BibTeX entry

Search

Latest News
- The Latest (03/04/2012)
- Generation5 10-year Anniversary (03/09/2008)
- New Generation5 Design! (09/04/2007)
- Happy New Year 2007 (02/01/2007)
- Where has Generation5 Gone?! (04/11/2005)

What's New?
- Back-propagation using the Generation5 JDK (07/04/2008)
- Hough Transforms (02/01/2008)
- Kohonen-based Image Analysis using the Generation5 JDK (11/12/2007)
- Modelling Bacterium using the JDK (19/03/2007)
- Modelling Bacterium using the JDK (19/03/2007)


All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -