✨ ARCANUM RUNE DIFFICULTY: Archmage Behavioral

The Interpreter of Whispers

Parse the incomprehensible grammar of the Ancestral Void into actionable magicks.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Linguistics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
GET "libhdr"

// Grammar: A = "Dark", B = "Light", expression parses combination
LET InterpretWhisper(whisperStr, len) = VALOF $(
  LET score = 0
  FOR i = 1 TO len DO $(
    LET ch = whisperStr%i
    IF ch = 'D' THEN score := score - 10
    IF ch = 'L' THEN score := score + 10
  $)
  RESULTIS score
$)

LET START() BE $(
  LET w1 = "DDDDL"
  LET w2 = "LLD"
  
  writef("Whisper '%s' alignment score: %d*n", w1, InterpretWhisper(w1, 5))
  writef("Whisper '%s' alignment score: %d*n", w2, InterpretWhisper(w2, 3))
$)
Runic Tags: #interpreter #linguistics #void