Iterator
Traversing the generations of a bloodline bound by a century curse.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Iterator
ARCANUM SCHOOL: Divination // Tracking
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// RAKU PATTERN //
class Descendant {
has Str $.name;
has Int $.generation;
}
class Bloodline {
has Descendant @.members;
method add(Descendant $d) { @!members.push($d) }
# Returning a Raku Sequence which acts as an iterator
method traverse-generations() {
return seq {
for @!members -> $member {
take $member;
}
};
}
}
my $bloodline = Bloodline.new;
$bloodline.add(Descendant.new(name => "Aric the First", generation => 1));
$bloodline.add(Descendant.new(name => "Beric the Bold", generation => 2));
$bloodline.add(Descendant.new(name => "Ceric the Cursed", generation => 3));
my $iterator = $bloodline.traverse-generations();
for $iterator -> $descendant {
say "The Hundred-Year Curse passes to {$descendant.name} (Gen {$descendant.generation}).";
}
A curse meant to last a hundred years will inevitably span multiple generations. The Iterator pattern provides a standard mechanism to traverse the complex tree of a target’s bloodline, ensuring the magic flows seamlessly from parent to child without exposing the underlying genealogical data structure to the spell’s logic.
Runic Tags:
#behavioral
#iterator
#raku
#hundred-year-spell