✨ ARCANUM RUNE DIFFICULTY: Archmage Behavioral

The Interpreter: Automata within the Grid

Evaluate arcane opcodes on state vectors simultaneously.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Flow
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
let interpret [n] (tape: [n]i32) : i32 =
  loop (acc, pc) = (0, 0i64) while pc < n do
    let op = tape[pc]
    in if op == 1 then (acc + tape[pc+1], pc + 2)
       else if op == 2 then (acc * tape[pc+1], pc + 2)
       else (acc, pc + 1)
Runic Tags: #futhark #interpreter #state-machine