The Mediator Nexus
Centralizing complex communications between disparate magical entities to prevent chaotic cross-talk.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Mediator
ARCANUM SCHOOL: Enchantment // Telepathy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FSHARP PATTERN //
type IMediator =
abstract member Broadcast: string * Magus -> unit
and Magus(name: string, nexus: IMediator) =
member _.Name = name
member this.Send(msg) =
printfn "%s sends: %s" name msg
nexus.Broadcast(msg, this)
member _.Receive(msg) =
printfn "%s hears in their mind: %s" name msg
type TelepathicNexus() =
let mutable members : Magus list = []
member _.Join(magus) = members <- magus :: members
interface IMediator with
member _.Broadcast(msg, sender) =
members
|> List.filter (fun m -> m.Name <> sender.Name)
|> List.iter (fun m -> m.Receive(msg))
let nexus = TelepathicNexus()
let alice = Magus("Alice", nexus)
let bob = Magus("Bob", nexus)
let charlie = Magus("Charlie", nexus)
nexus.Join(alice)
nexus.Join(bob)
nexus.Join(charlie)
alice.Send("The wards are failing!")
The Telepathic Nexus untangles the web of communication. Instead of magi casting sending spells to everyone directly, they project their thoughts into the Mediator, which routes the aetheric whispers safely.
Runic Tags:
#behavioral
#mediator
#fsharp
#nexus