lib/automata/turing.rb
def feed(input) 
      @tape = Tape.new(input)
      @accept = false
      @reject = false

      stateHead = @start.to_s
      input.each_char do |symbol|
        toState = transition(stateHead, symbol)
        if @accept || @reject
          break
        else
          stateHead = toState
        end
      end
      
      resp = {
        input: input,
        accept: @accept,
        reject: @reject,
        head: stateHead,
        tape: @tape.memory,
        output: @tape.output
      }
      resp
    end
def feed(input) 
      @tape = Tape.new(input)
      @accept = false
      @reject = false

      stateHead = @start.to_s
      input.each_char do |symbol|
        toState = transition(stateHead, symbol)
        if @accept || @reject
          break
        else
          stateHead = toState
        end
      end
      
      resp = {
        input: input,
        accept: @accept,
        reject: @reject,
        head: stateHead,
        tape: @tape.memory,
        output: @tape.output
      }
      resp
    end
@todo Check that each state is connected.
   Iterate through each states to verify the graph
   is not disjoint.
 Runs the input on the turing machine and returns a Hash describing
 the machine's final state after running.

 @param [String] input the string to use as input/tape for the TM
 @return [Hash] a hash describing the TM state after running
   * :input [String] the original input string
   * :accept [Boolean] whether or not the TM halted in an accept state
   * :reject [Boolean] whether or not the TM halted in a reject state
   * :head [String] the state which the head halted
   * :tape [String] the resulting tape string