❄️ SNOBOL HEX DIFFICULTY: Apprentice Creational

The Factory Method of Snobol

Creating magical entities using string patterns.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Evocation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SNOBOL PATTERN //
        * Factory Method in SNOBOL4
        DEFINE('SUMMON(TYPE)')

        OUTPUT = SUMMON('DEMON')
        OUTPUT = SUMMON('ANGEL')
        :(END)

SUMMON
        SUMMON = IDENT(TYPE, 'DEMON') 'Summoned a minor demon' :S(RETURN)
        SUMMON = IDENT(TYPE, 'ANGEL') 'Summoned a lesser angel' :S(RETURN)
        SUMMON = 'Failed to summon' :(RETURN)
END

In the magical arts, a Factory Method allows the conjurer to specify a type, and the spell handles the intricate conditional branching needed to manifest the correct entity.

Runic Tags: #snobol #creational #factory-method