Module: Legion::Extensions::Agentic::Homeostasis::Surplus::Helpers::Constants

Included in:
SurplusEngine
Defined in:
lib/legion/extensions/agentic/homeostasis/surplus/helpers/constants.rb

Constant Summary collapse

TOTAL_CAPACITY =
1.0
MIN_RESERVE =
0.1
SURPLUS_THRESHOLD =
0.15
REPLENISH_RATE =
0.05
DEPLETION_RATE =
0.08
SURPLUS_LABELS =
{
  abundant: (0.6..1.0),
  moderate: (0.3...0.6),
  scarce:   (0.15...0.3),
  depleted: (0.0...0.15)
}.freeze
QUALITY_LABELS =
{
  peak:     (0.8..1.0),
  rested:   (0.6...0.8),
  residual: (0.3...0.6),
  degraded: (0.0...0.3)
}.freeze
ALLOCATION_TYPES =
%i[exploration consolidation speculation maintenance creative].freeze

Class Method Summary collapse

Class Method Details

.clamp(value, min = 0.0, max = 1.0) ⇒ Object



46
47
48
# File 'lib/legion/extensions/agentic/homeostasis/surplus/helpers/constants.rb', line 46

def clamp(value, min = 0.0, max = 1.0)
  value.clamp(min, max)
end

.quality_label(quality) ⇒ Object



38
39
40
# File 'lib/legion/extensions/agentic/homeostasis/surplus/helpers/constants.rb', line 38

def quality_label(quality)
  QUALITY_LABELS.find { |_label, range| range.cover?(quality) }&.first || :unknown
end

.surplus_label(amount) ⇒ Object



34
35
36
# File 'lib/legion/extensions/agentic/homeostasis/surplus/helpers/constants.rb', line 34

def surplus_label(amount)
  SURPLUS_LABELS.find { |_label, range| range.cover?(amount) }&.first || :none
end

.valid_allocation_type?(type) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/legion/extensions/agentic/homeostasis/surplus/helpers/constants.rb', line 42

def valid_allocation_type?(type)
  ALLOCATION_TYPES.include?(type)
end