Universal
Turing Machine



editor
terminal
instructions

Turing Machines

Turing Machines are hypothetical computers invented by Alan Turing. Turing Machines consist of a tape that extends infinitely at both ends and a "head" that can read and write to the tape. The Turing Machine performs a sequence of steps one at a time. Each step can perform one of the following four commands:
  1. Read the character beneath the tape head
  2. Write a character to the tape
  3. Move the tape head one cell to the left
  4. Move the tape head one cell to the right
Though Turing Machines only utilize a very basic set of commands, they are able to compute anything a normal computer can--albeit more difficultly.

Instructions

The parts of the Turing Machine simulator (corresponding to the definition above) are shown below.
is the head of our Turing Machine
C
67
is a character cell on the Turing Machine tape. Computers can only operate on numbers, so each character has an associated number. We use the ASCII character encoding system to convert characters to numbers. The character is shown in black and its associated number is shown in light red below the character. Some numbers have special meanings and therefore don't have an associated character, so they are represented as blanks.
To run a program in the simulator, use the "editor" tab to enter a program in the Brainfuck programming language, then click the "run" button in the bottom of the editor. To see the output of the program or enter characters to the simulator, use the "terminal" tab. Brainfuck is a programming language. Brainfuck programs are a sequence of commands performed in order.

Brainfuck Commands

>Move the tape head one space to the right
<Move the tape head one space to the left
+Increment the character beneath the tape head
-Decrement the character beneath the tape head
.Print out the character beneath the tape head
,Prompt the user to enter a character and write it beneath the tape head
[Read the character beneath the tape head; if the character is 0, then jump to the matching ], otherwise run the commands between [ and ].
]This command designates the end of a [ ... ] block. Like parenthesis in math, brackets in Brainfuck must be balanced and the outermost [ matches only with the outermost ].

Additional Commands

In addition to the Brainfuck commands, this Turing Machine simulator can also use the following commands; each command is a single character.
AThe Turing Machine halts and accepts the string.
RThe Turing Machine halts and rejects the string.
HThe Turing Machine halts without accepting nor rejecting the string.
#This is the comment character. It allows you to add text to your Brainfuck code without having any affect on its operation. Everything from after the # until the end of the line is ignored by the Turing Machine
Operating Speed:
Normal
Fast
Instant