ternlang-core 0.3.3

Compiler and VM for Ternlang — balanced ternary language with affirm/tend/reject trit semantics, @sparseskip codegen, and BET bytecode execution.
Documentation
// Module:  stdlib/apps/ternary_rl_agent.tern
// Purpose: Ternary Reinforcement Learning Agent
// Author:  RFI-IRFOS
// Ref:     https://ternlang.com

// RL Agent where exploration is an active 'tend' state.

struct RLAgent {
    policy: trittensor<4 x 4>,
    value: trittensor<4 x 4>
}

fn choose_action(agent: RLAgent, state: trittensor<4 x 1>) -> trit {
    @sparseskip
    let action_logits: trittensor<4 x 1> = agent.policy * state;
    
    let action: trit = action_logits[0, 0];
    if action == tend {
        return tend; // Explore state
    }
    return action; // Exploit state
}