The Strategy
Equipping algorithms dynamically like spellbooks in combat.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Evocation // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SCHEME PATTERN //
(define (execute-combat-strategy strategy target)
(strategy target))
(define (fire-strategy target)
(string-append "Incinerating " target))
(define (ice-strategy target)
(string-append "Freezing " target))
(execute-combat-strategy fire-strategy "Goblin")
Higher-order functions enable raw algorithmic strategy to be passed around and applied dynamically, the essence of tactical evocation.
Runic Tags:
#behavioral
#scheme
#higher-order-functions
#polymorphism