The Template Method of Potions
Defining the skeleton of an alchemical brewing process with customizable steps.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Transmutation // Alchemy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
interface PotionTemplate
exposes [Recipe, brewPotion]
imports []
Recipe : {
gatherIngredients : {} -> Str,
brew : Str -> Str,
bottle : Str -> Str
}
brewPotion : Recipe -> Str
brewPotion = \recipe ->
ingreds = recipe.gatherIngredients {}
brewed = recipe.brew ingreds
recipe.bottle brewed
# Example implementation
healingRecipe : Recipe
healingRecipe = {
gatherIngredients: \_ -> "Red herbs",
brew: \herbs -> "Boiled ${herbs} in pure water",
bottle: \liquid -> "Bottled ${liquid} in a glass vial."
}
Runic Tags:
#fast-functional-wards
#roc
#template-method