⚙️ PURESCRIPT RUNE DIFFICULTY: Apprentice Behavioral

The Strategy of Web Runes

Define a family of highly typed combat algorithms, making them interchangeable.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Divination // Tactical Foresight
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PURESCRIPT PATTERN //
module Arcane.Strategy where
import Prelude

-- Strategy Interface
type CombatStrategy = Int -> Int -> String

aggressiveStance :: CombatStrategy
aggressiveStance p _ = "Striking with power " <> show (p * 2)

defensiveStance :: CombatStrategy
defensiveStance _ d = "Shielding with power " <> show (d * 2)

executeCombat :: CombatStrategy -> Int -> Int -> String
executeCombat strategy power defense = strategy power defense
Runic Tags: #behavioral #strategy #purescript #runes