This simulation pits two AIs against each other, each with a unique, randomized strategy defined by a set of heuristic weights assigned at the start of the game. The weights determine the AI's "personality" for the duration of the match.
Heuristic Weights: AI Personality (Hidden)
The AI evaluates every possible move (position and rotation) and assigns a score to the resulting board state. The internal weights determine the value or penalty assigned to different board features:
Aggregate Height (Negative): The sum of all column heights. A heavier penalty means the AI prioritizes keeping the stack low and safe.
Complete Lines (Positive): The reward for clearing lines in a single move. A higher weight makes the AI aggressively focus on line clears.
Holes (Negative): The number of empty cells with blocks resting above them. A heavier penalty means the AI is hole-averse.
Bumpiness (Negative): The measure of height difference between adjacent columns. A heavier penalty encourages the AI to maintain a flat, smooth surface.
Lessons Learned: Principles of Life and Stability
The core mechanics of block stacking mirror universal principles of resource management, risk, and discipline. By observing the AI's success and failure patterns, we can learn valuable lessons:
The Foundation of Success (Height & Bumpiness): In life, as in the game, a stable, level foundation (low stack height and minimal bumpiness) provides the most flexibility for long-term growth. Chaotic foundations lead to rapid collapse, regardless of short-term success.
The Discipline of Immediate Repair (Holes): A 'hole' represents a problem or neglected task that prevents future progress. Ignoring small, solvable gaps to pursue a larger goal often results in accumulating irreparable risks. Disciplined individuals address small problems before they become catastrophic barriers.
Balancing Risk and Reward (Complete Lines): The highly aggressive AI aims for large wins (Tetrises) but often sets itself up for danger. The conservative AI makes slow, steady progress. The lesson is to calculate risk: only pursue high-reward strategies when the fundamental foundation is secure.
Adaptive Strategy (Panic Mode): When circumstances escalate (the stack height grows), a fixed mindset is dangerous. The AI's Panic Mode—shifting focus purely to survival and damage control—is a model for when you must temporarily abandon ambition and prioritize stabilizing your situation (financial, mental, or professional) before returning to growth.
The Panic Mode (indicated below the score) is the AI's simple adaptive strategy: when the stack gets too high, it temporarily increases its penalty for height and holes, forcing a focus on immediate damage control rather than long-term scoring strategy.