AI CORE SYSTEMS ARCHITECTURE

C++ | C# | Decision Trees | Adversarial Search Optimization

Christopher Wilt - Systems Engineer

LOW-LEVEL ARTIFICIAL INTELLIGENCE LAB HOARDS

01. Adversarial Tree Search & Alpha-Beta Pruning (C#)

Engineered a highly optimized look-ahead decision agent modeled on an adversarial tree structure, maximizing calculation efficiency through strict logic pruning.

Architected a recursive Alpha-Beta MiniMax Engine to predict optimal opponent response trajectories several turns in advance. Implemented mathematical branch cutoffs ($β \le \alpha$) to prune unoptimized game tree paths, stopping exponential calculation inflation. Developed smart forfeit handlers to smoothly route execution states when a player is forced to pass a turn.

Designed a phase-based adaptive heuristic utility calculator. The evaluation logic checks game progression metrics, shifting its scoring bias automatically from early positional matrix weighting to mid-game movement restrictions, and final-stage absolute piece count evaluations. Integrated real-time visual tracking endpoints to map decision vectors across external analytics software.

// 1. Recursive Alpha-Beta MiniMax Engine
public float AlphaBeta(Node node, int depth, float alpha, float beta, bool isMaximizing) {
    if (depth == 0 || node.IsTerminal()) {
        return CalculateAdaptiveHeuristic(node);
    }

    if (isMaximizing) {
        float maxEval = float.NegativeInfinity;
        foreach (Node child in node.GetValidMoves()) {
            float eval = AlphaBeta(child, depth - 1, alpha, beta, false);
            maxEval = Mathf.Max(maxEval, eval);
            alpha = Mathf.Max(alpha, eval);
            
            // 2. Mathematical Branch Cutoff
            if (beta <= alpha) break; // Prune unoptimized tree paths
        }
        return maxEval;
    } else {
        float minEval = float.PositiveInfinity;
        foreach (Node child in node.GetValidMoves()) {
            float eval = AlphaBeta(child, depth - 1, alpha, beta, true);
            minEval = Mathf.Min(minEval, eval);
            beta = Mathf.Min(beta, eval);
            
            if (beta <= alpha) break; 
        }
        return minEval;
    }
}

02. Autonomous Swarm Steering & Emergent Flocking Simulation (C#)

Moved past basic individual pathfinding scripts to implement complex group simulation kinematics derived from Craig Reynolds' Autonomous Agent Vectors.

Engineered real-time vector field evaluation systems to calculate group dynamics. The tracking functions monitor collective swarm positions to generate centripetal attraction (Cohesion), while balancing group headings to align velocities (Alignment). Written a local repulsion mechanic (Separation) that scales forces inversely via distance math to avoid internal entity collisions.

Integrated these component vectors into a single kinematic acceleration loop. Scaled calculations dynamically using delta-time values to protect agent behavior continuity against runtime frame rate fluctuations, maximizing mass multi-entity throughput.

// 1. Calculate Group Dynamics
Vector3 cohesion = Vector3.zero;
Vector3 alignment = Vector3.zero;
Vector3 separation = Vector3.zero;

foreach (Agent neighbor in swarm) {
    float distance = Vector3.Distance(transform.position, neighbor.position);
    if (distance > 0 && distance < perceptionRadius) {
        cohesion += neighbor.position;
        alignment += neighbor.velocity;
        // Scale repulsion inversely via distance
        separation += (transform.position - neighbor.position) / distance;
        neighborCount++;
    }
}

if (neighborCount > 0) {
    cohesion = (cohesion / neighborCount) - transform.position;
    alignment /= neighborCount;
}

// 2. Kinematic Acceleration Scaled by Delta-Time
Vector3 steering = (cohesion * wCohesion) + (alignment * wAlign) + (separation * wSep);
velocity += steering * Time.deltaTime;
transform.position += velocity * Time.deltaTime;

03. Heuristic Pathfinding & Non-Blocking Timesliced Search (C++)

Developed a high-performance implementation of the A* Pathfinding Algorithm over coordinate grids, balancing heuristic evaluations with strict execution time budgets.

Architected a search pipeline calculating given movement costs (g) and estimated Euclidean distances (h) to process overall path weight parameters. Used fast hash-map lookups to manage visited node configurations, cutting evaluation durations in large layout spaces. Handled row-offset validation rules to safely isolate connectivity vectors across non-standard grid geometry.

To prevent severe CPU thread starvation spikes during deep map inspections, engineered a non-blocking Timesliced Update System. The pathfinder splits search operations across specific temporal frames, allowing the main engine game loop to retain high rendering speeds while long-range route data computes in the background.

// 1. Timesliced Update System (Non-Blocking)
ExecutionStatus Pathfinder::ProcessSearch(float timeBudgetMs) {
    auto startTime = std::chrono::high_resolution_clock::now();

    while (!openSet.empty()) {
        auto currentTime = std::chrono::high_resolution_clock::now();
        std::chrono::duration<float, std::milli> elapsed = currentTime - startTime;
        
        // Yield CPU back to main engine loop if budget exceeded
        if (elapsed.count() >= timeBudgetMs) {
            return ExecutionStatus::PENDING; 
        }

        Node* current = GetLowestFCostNode(openSet);
        if (current == targetNode) return ExecutionStatus::COMPLETE;

        // 2. Heuristic Euclidean Evaluations
        for (Node* neighbor : GetValidNeighbors(current)) {
            float gCost = current->gCost + CalculateDistance(current, neighbor);
            if (gCost < neighbor->gCost) {
                neighbor->gCost = gCost;
                neighbor->hCost = GetEuclideanDistance(neighbor, targetNode);
                neighbor->fCost = neighbor->gCost + neighbor->hCost;
            }
        }
    }
    return ExecutionStatus::FAILED;
}

04. N-ary Behavior Tree Infrastructure & Memory Auditing (C++)

Built the underlying core engine architecture and custom memory-managed container foundations that empower modular AI decision-making.

Bypassed heavy standard library components to engineer a template-based, singly-linked QueueList container from scratch. Written custom Iterator wrappers—overloading pointer increments and dereferences—to allow memory-safe asset traversals across internal allocation layouts in constant time.

Constructed an abstract Behavior base class to form the parent-child relationships of an N-ary tree system. Developed the three foundational logic validation traversals (Breadth-First, Pre-Order, and Post-Order recursive searches) to aggregate action results. Built static validation variables to perform strict compile-level memory leak tracking across all live node trees.

// 1. Template-Based Container & Iterator Wrapper
template <typename T>
class QueueList {
private:
    struct Node { T data; Node* next; };
    Node* head;

public:
    class Iterator {
        Node* current;
    public:
        Iterator(Node* node) : current(node) {}
        T& operator*() { return current->data; } 
        Iterator& operator++() { current = current->next; return *this; }
        bool operator!=(const Iterator& other) const { return current != other.current; }
    };

// 2. Strict Compile-Level Memory Auditing
#ifdef _DEBUG
    static inline int activeNodeAllocations = 0;
#endif

// Constructor / Destructor memory tracking
    QueueList() { /* ... */ }
    ~QueueList() { 
        Clear(); 
        assert(activeNodeAllocations == 0 && "Memory Leak Detected!");
    }
};