# File lib/libgenetics.rb, line 84
  def gray_encode
    gray = self[0..0]
    (1...self.length).each do |i|
      if (self[i - 1] == 1) ^ (self[i] == 1)
        gray << 1
      else
        gray << 0
      end
    end
    gray
  end