ENGINE V1.0 UNITY C#

BALOOT ARCHITECT

A technical deep-dive into the state machine, heuristic AI, and card interaction logic powering the game.

01. Core Classification

GameManager

SINGLETON

The central nervous system. Orchestrates the Game Loop (Mukabara -> Dealing -> Playing) using Unity Coroutines.

Instance (Static)
State Machine

BotBrain

STATIC LOGIC

Pure logic container. No state storage. Evaluates hands for Buying and determines optimal Card Play.

EvaluateBuy()
ChooseBestCard()

Card Entity

MONOBEHAVIOUR

Hybrid data-visual object. Handles Vector3.Lerp movement and stores Suit/Rank enumerations.

Interactable
Rank Value

Execution Lifecycle

COROUTINE SEQUENCE

Mukabara Dealer Selection
Visual Cut Deck Split
BUY
Buying Phase Sun / Hokom
Playing 8 Tricks Loop
Result Score Calculation
Initialization Decision Making Runtime

03. AI Decision Structure

EvaluateBuy() Logic Tree

Input: Hand + Ground Card
Has Winning Project?
400 (Aces) OR 100
SUN Logic
Points >= 20
BUY SUN
HOKOM Logic
Jack + 9 + Ace
BUY HOKOM
BotBrain.cs
// Evaluating whether to buy or pass
public static int EvaluateBuy(List<Card> hand, Card groundCard) 
{
    // 1. Check for '400' or '100' projects
    if (HasWinningProject(hand)) return 1; // Buy Sun

    // 2. Calculate Sun strength (A=11, 10=10...)
    int strength = CalculateSunHandStrength(hand);
    if (strength >= 20) return 1;

    // 3. Check for specific Hokom combos
    if (IsGoodHokomHand(hand, groundCard.suit)) 
    {
        return 2; // Buy Hokom
    }

    return 0; // Pass
}

04. Data Models & Values

Card Rank Sun Points (San) Project Capability Hokom Role
ACE (7) 11 Points 400 (4 Aces) Strong (3rd)
TEN (3) 10 Points 100 (4 Tens) Moderate
KING (6) 4 Points 100 (4 Kings) BALOOT (K+Q)
JACK (4) 2 Points 100 (4 Jacks) HIGHEST (Akbar)
NINE (2) 0 Points - 2nd Highest