File size: 944 Bytes
a8b4b87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""AMARU — kundalini scheduler. Fires 7 chakras in serpentine order.

Doctrine: ≤10 SLOC. Ascending phase = propose (1→7). Descending phase = commit (7→1).
Serpent shape: single thread, head-to-tail, no branching mid-tick.
"""
from typing import Callable, Any

ASCEND = ["KALLPA", "YACHAY", "RIMAY", "YUYAY", "RUWAY", "NAWI", "HATUN"]

def amaru(chakras: dict, state: dict, world: dict, yawar: list) -> tuple:
    """Run one full serpentine tick. Returns (new_state, new_yawar, trace)."""
    trace = []
    for name in ASCEND:                          # 1 — kundalini rises
        fn = chakras[name]
        result = fn(state, world, yawar)
        trace.append((name, result))             # 2 — receipt per chakra
        state = result.get("state", state)       # 3 — state evolves
        yawar = result.get("yawar", yawar)       # 4 — bus accumulates
    return state, yawar, trace                   # 5 — single return