This is a Tetris-playing AI with support for automated optimization using a weight-based utility function.
- Play Tetris with a custom agent (Dellacherie-Thiery)
- Run multiple episodes for benchmarking
- Optimize the agent's weights using simulated annealing
- Headless mode for faster, non-visual simulation
- Automatically initializes a
weights.jsonfile to store learned weights
- Python 3.9+
pygamenumpy
Install dependencies with:
pip install -r requirements.txtRun the Tetris AI using the command-line interface.
python main.py runOptions:
--episodes N: Number of episodes to run (default: 200)--headless: Disable rendering for faster evaluation
Example:
python main.py run --episodes 100 --headlesspython main.py optimizeOptions:
--headless: Disable rendering during optimization
Example:
python main.py optimize --headlessWhen the program is first run, it checks for the existence of a file called weights.json. If it doesn't exist, it creates one and initializes it with an empty object ({}). This file is used by the optimizer to store and update the weights that define the agent's decision-making.