A Tetris Game with Reinforcement Learning AI Agent
-
Clone the repository and install dependencies from
requirements.txtpip install -r requirements.txt -
Open the folder in Visual Studio Code and run:
python3 project/main.py
- Classic Tetris with responsive controls
- Player vs AI mode with difficulty levels
- Realistic AI moves
- Versus AI garbage lines
- T-spins
- Retrainable Tetris Agent (Genetic Algorithm)
- Mutation rate: 0.05
- Mutation step: 0.2
- Reward/Fitness: pieces survived + lines cleared
- Feature function: holes, bumpiness, weighted height, cumulative height, relative height, vertical hole tunnels, max well depth, sum wells, weighted filled cells, landing height, hole depth, row hole
- Generations: 17
- Population: 60
- Games: 1,020 gameovers
- Standard 7-Bag w/ changing seeds per generation

- Generations: 24
- Population: 240 (4x bigger sample)
- Games: 5,760 gameovers
- 11-Bag: 7Bag but 3x more S & Z hard mode pieces
- Changing seeds

Language: Python
Main Library: pygame
Optional Library: pyinstaller (exe bundling), matplotlib (training)

