🐢 LOGO DIVINATION DIFFICULTY: Apprentice Creational

Factory Method: The Spawning Pools of LOGO

Define an interface for creating a turtle entity, but let subclasses (or specific procedure branches) alter the type of spirit summoned.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Cyber-Spirits
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// LOGO PATTERN //
to spawn-spirit :type
  if equal? :type "seeker [ output [ [type seeker] [speed 10] [color red] ] ]
  if equal? :type "weaver [ output [ [type weaver] [speed 5] [color blue] ] ]
  output [ [type anomaly] [speed 0] [color black] ]
end

to trace-spirit :spirit
  localmake "col last assoc "color :spirit
  setpencolor :col
  ; Divination trace based on spirit
  fd 50
end

make "my-spirit spawn-spirit "seeker
trace-spirit :my-spirit
Runic Tags: #turtle-divination #Lisp-like