🥞 FORTH STACK DIFFICULTY: Adept Behavioral

Mediator (Forth)

A central sigil to route the chaos of warring spirits.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Mediator
ARCANUM SCHOOL: Enchantment // Sigil-Routing
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FORTH PATTERN //
\ Sigil-Routing: The Mediator
\ A hub word that dictates interactions between systems.

VARIABLE FIRE-POWER
VARIABLE WATER-POWER

: MEDIATE-ELEMENTS ( -- )
  FIRE-POWER @ WATER-POWER @ > IF
    ." Fire consumes the Water." CR
    0 WATER-POWER !
  ELSE
    ." Water extinguishes the Fire." CR
    0 FIRE-POWER !
  THEN ;

: FEED-FIRE ( n -- )
  FIRE-POWER +! MEDIATE-ELEMENTS ;

: FEED-WATER ( n -- )
  WATER-POWER +! MEDIATE-ELEMENTS ;

\ Usage:
\ 10 FEED-FIRE
\ 20 FEED-WATER

When independent modules (or elements) grow too interconnected, chaos ensues. The Mediator is a singular, central word that handles the routing and collision of systems. Rather than letting the fire directly quench the water, both report to the Mediator.

Runic Tags: #behavioral #mediator #forth #routing