The Strategy
Hot-swapping combat incantations dynamically during arcane duels.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Evocation // Dynamic Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// OCAML PATTERN //
type strategy = int -> int -> int
let aggressive_tactic x y = x * y
let defensive_tactic x y = x + y
let execute_tactic strat x y = strat x y
let power = execute_tactic aggressive_tactic 10 5
Passing functions as first-class values provides the ultimate Strategy pattern. The sorcerer switches their tactical algorithms instantly based on the opponent’s movements.
Runic Tags:
#Caml Metamagic
#First-Class Functions
#OCaml