Class WriteFirstTuringMachine

A object for simulate the turing machine, but the machine will write symbol before read the tape.

Implements

Constructors

Properties

acceptState: null | TMState
blank: TMSymbol
halt: boolean = false
headPosition: number = 0
initState: null | TMState = null
initialWord: null | TMSymbol[] = null
nowState: null | TMState = null
tape: null | TMTape = null

Methods

  • Returns a tuple representation of this machine.

    Returns {
        acceptState: null | TMState;
        blankSymbol: TMSymbol;
        inputSymbolSet: Set<TMSymbol>;
        ruleset: WriteFirstTMRuleSet;
        stateSet: Set<TMState>;
        symbolSet: Set<TMSymbol>;
    }

    a tuple representation of this machine.

    Remarks

    A Turing machine is represented as follows:

    • stateSet - List of all states this machine uses.
    • symbolSet - List of all symbols this machine uses.
    • blankSymbol - A blank symbol.
    • inputSymbolSet - List of all symbols that can be used for words processed by this machine. (In this implementation, it is exactly the same as symbolSet.)
    • initState - The state of this machine when it starts.
    • acceptState - The state when this machine accepts a word.
  • Returns whether this machine is in the accepted state.

    Returns boolean

    True if this machine is in the accepted state, false otherwise.

  • Proceeds with this machine. This method must be called after WriteFirstTuringMachine.start called, or get an error,

    Parameters

    • step: number = 1

      Non-negative integer indicating how many steps to advance this machine.

    Returns void

    Remarks

    One "step" is a series of processes that writes the symbol, moves the head, reads a symbol, and changes its state.

  • Initiates processing for a given word.

    Parameters

    • input: [word: TMSymbol[], headPosition: number, state: TMState]

      the Write-First TM's input. It' an array that contains the following elements:

      • word - A word being processed.
      • headPosition - Relative position of the head at the start of processing. For Instance, "3" means to start from word[3], and "-1" means to start from the blank symbol to the left of the word.
      • state - now internal state.

    Returns void

Generated using TypeDoc