The State of Snobol
Shifting behavior as the phases of the moon change.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Transmutation // Phase Shifting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SNOBOL PATTERN //
* State Pattern in SNOBOL4
DEFINE('CAST_PHASE()')
PHASE = 'WAXING'
CAST_PHASE()
PHASE = 'FULL'
CAST_PHASE()
:(END)
CAST_PHASE
IDENT(PHASE, 'WAXING') :S(PHASE_W)
IDENT(PHASE, 'FULL') :S(PHASE_F)
:(RETURN)
PHASE_W OUTPUT = 'Weak magic flows.' :(RETURN)
PHASE_F OUTPUT = 'Maximum power unleashed!' :(RETURN)
END
The State pattern dynamically changes the outcome of a spell based on an external state variable, such as the phase of the moon. The spell branches internally, providing different manifestations.
Runic Tags:
#snobol
#behavioral
#state