Files

28 lines
1.8 KiB
C
Raw Permalink Normal View History

2026-07-09 13:28:07 -04:00
#ifndef GLYPH_GRAPH_H
#define GLYPH_GRAPH_H
#include "../common/glyph_types.h"
typedef enum { SYM_VOID=0, SYM_NASCENT, SYM_WEAK, SYM_MODERATE, SYM_STRONG, SYM_RADIANT, SYM_ABSOLUTE } SymLevel;
typedef enum { RES_DISSONANT=0, RES_INERT, RES_HARMONIC, RES_RESONANT, RES_ENTANGLED } SymResonance;
struct GlyphNode_s; struct GlyphGraph_s;
typedef void (*PropagateFn)(struct GlyphNode_s* n, struct GlyphGraph_s* g);
typedef struct { uint8_t id; const char* name; uint8_t arity; float base_stability; PropagateFn propagate; } GlyphDef;
extern const GlyphDef GLYPH_DEFS[];
typedef struct GlyphNode_s { int active; uint8_t glyph_id; TraitMask traits; uint32_t lineage_id; SymLevel coherence; SymLevel stability; SymLevel energy; uint32_t mutation_count; uint32_t last_epoch; uint32_t edge_count; uint32_t edges[8]; SymResonance edge_weights[8]; } GlyphNode;
typedef struct GlyphGraph_s { char *name; uint32_t node_count; GlyphNode *nodes; uint32_t epoch; int converged; SymLevel global_coherence; SymLevel global_stability; SymLevel global_energy; } GlyphGraph;
GlyphGraph* graph_create(const char* name, uint32_t cap);
void graph_destroy(GlyphGraph* g);
int graph_add_node_with_value(GlyphGraph* g, uint8_t glyph_id, int value);
void graph_connect(GlyphGraph* g, uint32_t from, uint32_t to, SymResonance weight);
void graph_compact(GlyphGraph* g);
void graph_print(GlyphGraph* g);
const GlyphDef* glyph_lookup(const char* name);
const char* sym_level_name(SymLevel l);
const char* sym_res_name(SymResonance r);
SymLevel sym_decay(SymLevel s, SymLevel c);
SymLevel sym_diminish(SymLevel e, int amt);
SymLevel sym_boost(SymLevel e, int amt);
int resonance_conflicts(TraitMask a, TraitMask b);
SymResonance resonance_between_nodes(GlyphNode* a, GlyphNode* b);
SymResonance resonance_between_glyphs(uint8_t a, uint8_t b);
#endif