def better_result(base_result, result = nil)
      base_result ||= {}
      return base_result unless result

      return result unless base_result.values.find { |e| e[:possible].any? }

      return result if result.values.find { |e| e[:valid].any? }

      base_result
    end
def better_result(base_result, result = nil)
      base_result ||= {}
      return base_result unless result

      return result unless base_result.values.find { |e| e[:possible].any? }

      return result if result.values.find { |e| e[:valid].any? }

      base_result
    end
method checks which result is better to return