⚔️ RPG WARD DIFFICULTY: Adept Structural

Composite: The Fractal Ward

Compose runes into tree structures to represent part-whole hierarchies.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Illusion // Phantasm
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// RPG PATTERN //
**FREE
Ctl-Opt NoMain;

Dcl-Ds RuneNode_t Qualified Template;
  Name Char(20);
  ChildCount Int(10);
  Children Pointer Dim(10); // Array of pointers to other nodes
End-Ds;

Dcl-Proc ProcessNode Export;
  Dcl-Pi *N;
    pNode Pointer Value;
  End-Pi;

  Dcl-Ds Node Likeds(RuneNode_t) Based(pNode);
  Dcl-S i Int(10);

  // Process current node
  Dsply Node.Name;

  // Recursively process children
  For i = 1 to Node.ChildCount;
     ProcessNode(Node.Children(i));
  EndFor;
End-Proc;

Composite

Tree structures are native to IFS filesystems and hierarchical menus in IBM i. The Composite pattern allows individual Runes and collections of Runes to be handled uniformly.

Runic Tags: #structural #ibm-i #runes #composite