def parse_mode(m)
      result = 0
      (1..9).each do |i|
        result = 2 * result + ((m[i] == ?-) ? 0 : 1)
      end
      result
    end
def parse_mode(m)
      result = 0
      (1..9).each do |i|
        result = 2 * result + ((m[i] == ?-) ? 0 : 1)
      end
      result
    end
--------------------------------------------------------