Tetris AI — Genetic Algorithm Optimization
An autonomous agent optimized via Genetic Algorithms to play Tetris at a high level.
Evolves heuristic weights over generations to learn stable strategies in a large state space without supervised data.
Project Details
Technologies
Key Metrics
10.3M
Max score
250+
Generations
The Problem
Tetris is a computationally difficult game for AI due to the vast state space and the need for long-term planning. Traditional heuristics often fail as the game speed increases.
The Solution
I implemented an agent powered by a Genetic Algorithm (GA). I evolved a population of heuristic weights over hundreds of generations, allowing the AI to "discover" the most effective strategies for clear-line priority, hole avoidance, and surface smoothness.
Architecture & Implementation
- Core: Python implementation of the Tetris engine and GA framework.
- Optimization: Fitness function based on multi-variate heuristics (bumpiness, aggregate height, holes).
- Simulation: High-speed headless runs to accelerate the evolutionary process.
Results & Impact
The final evolved agent reached a record score of 10.3M points, consistently surviving for thousands of lines and outperforming standard deep Q-learning implementations in stability.