The Strategy of Snobol
Swapping out the underlying mechanics of a spell on the fly.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Evocation // Tactical Casting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SNOBOL PATTERN //
* Strategy Pattern in SNOBOL4
DEFINE('ATTACK(STRATEGY)')
ATTACK('FIRE_STRATEGY')
ATTACK('ICE_STRATEGY')
:(END)
ATTACK
EVAL(STRATEGY '()') :(RETURN)
FIRE_STRATEGY
OUTPUT = 'Casting a volatile burst of flame!' :(RETURN)
ICE_STRATEGY
OUTPUT = 'Unleashing a piercing shard of frost!' :(RETURN)
END
Strategy separates the intent from the method. By passing the name of the algorithmic incantation as a string, the caster can dynamically swap whether they wish to use fire or ice, evaluating the chosen method at runtime.
Runic Tags:
#snobol
#behavioral
#strategy