The Strategy
Parameterizing algorithms into interchangeable Gallina Wards, allowing rapid combat adaptation against planar threats.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Divination // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
(* Gallina Ward: Strategy *)
Require Import String.
(* The Strategy Interface *)
Definition RoutingStrategy := nat -> nat -> nat.
Definition aggressiveRoute : RoutingStrategy := fun a b => a * b.
Definition defensiveRoute : RoutingStrategy := fun a b => a + b.
Definition evasiveRoute : RoutingStrategy := fun a b => a - b.
Record ArcaneRouter := {
strategy : RoutingStrategy
}.
Definition executeRoute (router : ArcaneRouter) (x y : nat) : nat :=
router.(strategy) x y.
Definition combatRouter := {| strategy := aggressiveRoute |}.
Definition result := executeRoute combatRouter 10 5.
Runic Tags:
#strategy
#gallina
#wards