lib/automata/turing.rb
def transition(read, write, move)
      if read == @memory[@head]
        @memory[@head] = write
        case move
        when 'R'
          # Move right
          @memory << '@' if @memory[@head + 1]
          @head += 1
        when 'L'
          # Move left
          @memory.unshift('@') if @head == 0
          @head -= 1
        end
        return true
      else
        return false
      end
    end
def transition(read, write, move)
      if read == @memory[@head]
        @memory[@head] = write
        case move
        when 'R'
          # Move right
          @memory << '@' if @memory[@head + 1]
          @head += 1
        when 'L'
          # Move left
          @memory.unshift('@') if @head == 0
          @head -= 1
        end
        return true
      else
        return false
      end
    end
Creates a new tape.

 @param [String] string the input string
 Transitions the tape.

 @param [String] read the input symbol read
 @param [String] write the symbol to write
 @param [String] move Either 'L', 'R', or 'S' (default) to
   move left, right, or stay, respectively.
 @return [Boolean] whether the transition succeeded