⚙️ C RUNE DIFFICULTY: Apprentice Behavioral

The Primordial Strategy

Swapping combat doctrines mid-ritual without altering the battle matrix.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Universal // Martial Magic
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// C PATTERN //
#include <stdio.h>

typedef struct {
    void (*execute_tactic)(void);
} CombatStrategy;

void aggressive_tactic(void) { printf("All out magical assault!\n"); }
void defensive_tactic(void) { printf("Raising a barrier of thorns!\n"); }

typedef struct {
    CombatStrategy* strategy;
} WarGolem;

void golem_fight(WarGolem* golem) {
    if (golem->strategy) {
        golem->strategy->execute_tactic();
    }
}

int main() {
    CombatStrategy aggro = { aggressive_tactic };
    CombatStrategy defend = { defensive_tactic };

    WarGolem golem = { &aggro };
    printf("Engaging enemy...\n");
    golem_fight(&golem);

    printf("Health critical, switching tactics...\n");
    golem.strategy = &defend;
    golem_fight(&golem);

    return 0;
}

The Primordial Strategy isolates algorithms of war. A War Golem simply possesses a pointer to a CombatStrategy. By dynamically reassigning this pointer at runtime, the Golem’s nature shifts flawlessly from aggression to defense without a single conditional check.

Runic Tags: #c #behavioral #strategy #interchangeable