We finally have everything in play to start using a turing machine. We need a Tapeand a Program and we are set to run or step through the operations of the turing machine.
In this example we will step throught a turing machine that keeps writing a series of I to the its tape.
gap> LoadPackage("turing");; gap> tape := TmTape(); <tape empty> gap> program := TmProgram(TmState(1)); <program empty> gap> TmAddRule(program, TmState(1), TmBlank(), TmState(1), TmSymbol('I'), TmRight()); gap> machine := TmMachine(tape, program); <machine q1 <tape empty>> gap> TmStep(machine); gap> machine; <machine q1 <tape |_I[_]__|>> gap> TmStep(machine); gap> machine; <machine q1 <tape |II[_]__|>>
‣ TmMachine( tape, program ) | ( operation ) |
Returns: a turing machine
This returns a turing machine that uses program on tape.
‣ TmStep( machine ) | ( operation ) |
let the machine take a single step through its program.
‣ TmRun( machine ) | ( operation ) |
let the machine run its course.
‣ TmTrace( machine ) | ( operation ) |
let the machine run its course, displaying each step.
‣ TmStepCount( machine ) | ( operation ) |
Returns: the number of steps taken.
The number of steps this turing machine has taken during its computation.
generated by GAPDoc2HTML