def assigned_key(key)
      return @key_assignments[key] if @key_assignments[key]
      available_keys = @input_values.keys - @key_assignments.values
      return nil if available_keys.empty?
      if available_keys.include?(key)
        @key_assignments[key] = key
      else
        @key_assignments[key] = available_keys[rand(available_keys.length)]
      end
      @key_assignments[key]
    end
def assigned_key(key)
      return @key_assignments[key] if @key_assignments[key]
      available_keys = @input_values.keys - @key_assignments.values
      return nil if available_keys.empty?
      if available_keys.include?(key)
        @key_assignments[key] = key
      else
        @key_assignments[key] = available_keys[rand(available_keys.length)]
      end
      @key_assignments[key]
    end
Returns the input key assigned to the given get_unit key.
If none is assigned, randomly assigns one of the available input keys.