🐺 WOLFRAM ALCHEMY DIFFICULTY: Adept Behavioral

The Mediator Incantation

Centralizing complex communications between various elemental spirits.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Mediator
ARCANUM SCHOOL: Enchantment // Diplomacy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MATHEMATICA PATTERN //
(* The Spirit Nexus (Mediator) *)
ClearAll[NexusSend, RegisterSpirit];

$Spirits = <||>;

RegisterSpirit[name_, element_] := ($Spirits[name] = element);

NexusSend[from_, to_, message_] := 
  If[KeyExistsQ[$Spirits, to],
    Print["[Nexus] Routing message from ", from, " (", $Spirits[from], ") to ", to, ": ", message],
    Print["[Nexus] Spirit ", to, " not found in the network."]
  ];

(* Usage *)
RegisterSpirit["Ignax", "Fire"];
RegisterSpirit["Aquiel", "Water"];
RegisterSpirit["Terran", "Earth"];

NexusSend["Ignax", "Aquiel", "Do not extinguish my flames!"];
NexusSend["Aquiel", "Terran", "Nourish the roots."];
Runic Tags: #mediator #behavioral #centralization #routing