✨ ARCANUM RUNE DIFFICULTY: Apprentice Behavioral

The Command Scroll

Encapsulates a request as an object, allowing parameterization of spell scrolls.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Scribing
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
type command
  CastFireball(target: string)
  Heal(target: string)

fun execute(cmd: command) : ()
  match cmd
    CastFireball(t) -> println("Fireball erupts towards " ++ t)
    Heal(t) -> println("Healing light surrounds " ++ t)

pub fun main()
  val scroll-queue = [CastFireball("Goblin"), Heal("Ally"), CastFireball("Dragon")]
  scroll-queue.map(execute)
Runic Tags: #koka #command #adt