viva_emotion/stimulus

Stimulus - Events that perturb emotional state Exhaustive pattern matching ensures all cases handled

Types

All possible stimuli that can affect VIVA Adding a new variant FORCES handling everywhere (compiler enforced)

pub type Stimulus {
  Rejection
  Acceptance
  Companionship
  Loneliness
  Success
  Failure
  Threat
  Safety
  HardwareStress
  HardwareComfort
  LucidInsight
  GrimRealization
  Rebirth
  NearDeath
}

Constructors

  • Rejection
  • Acceptance
  • Companionship
  • Loneliness
  • Success
  • Failure
  • Threat
  • Safety
  • HardwareStress
  • HardwareComfort
  • LucidInsight
  • GrimRealization
  • Rebirth
  • NearDeath

Personality-specific stimulus weight overrides Only overridden stimuli need to be in the dict

pub type StimulusWeights =
  dict.Dict(Stimulus, pad.Pad)

Values

pub fn apply(
  state: pad.Pad,
  stimulus: Stimulus,
  intensity: Float,
) -> pad.Pad

Apply a stimulus to a PAD state with optional intensity

pub fn apply_with(
  state: pad.Pad,
  stimulus: Stimulus,
  intensity: Float,
  overrides: dict.Dict(Stimulus, pad.Pad),
) -> pad.Pad

Apply stimulus with personality-specific weights

pub fn default_weights() -> dict.Dict(Stimulus, pad.Pad)

Create empty weights (use all defaults)

pub fn to_pad_delta(stimulus: Stimulus) -> pad.Pad

Get the PAD delta for a stimulus These weights define VIVA’s “personality”

pub fn to_pad_delta_with(
  stimulus: Stimulus,
  overrides: dict.Dict(Stimulus, pad.Pad),
) -> pad.Pad

Get PAD delta with personality override Checks override first, falls back to exhaustive default

pub fn weight(
  weights: dict.Dict(Stimulus, pad.Pad),
  stimulus: Stimulus,
  delta: pad.Pad,
) -> dict.Dict(Stimulus, pad.Pad)

Helper to create a weight override (pipe-friendly)

Search Document