uiucanh / tetris

Implementing an agent for Tetris (GB) using genetics algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tetris - Genetic Algorithm

This repo contains the implementation of an agent for the original Tetris (GameBoy) using genetics aglorithm.

Medium article

Installation

Using pip

pip install -r requirements.txt

Follows installation for PyBoy at https://github.com/Baekalfen/PyBoy#installation

Training

To train with the approach in the article, run python tetris.py make sure that ROM is available in the directory and named tetris_1.1.gb.

There's also an implementation of NEAT which you can find in tetris_neat.py

Play

Inside models, there's a file best.pkl which contains the best model obtained after 10 epochs, run python play.py to get an average 10 runs scores of the model

To play the games with the model from NEAT, use play_neat.py

About

Implementing an agent for Tetris (GB) using genetics algorithm


Languages

Language:Python 100.0%