NEAT-Pacman is a Pacman agent trained with NEAT (NeuroEvolution of Augmenting Topologies). It learns to move through the maze and eat dots over many generations.
Trained agent replay:
Fitness history:

src/Pacman.py: game simulation, training, and replaysrc/optimize.py: Optuna hyperparameter tuningsrc/config/neat_config.txt: NEAT settingssrc/outputs/: generated training and replay filesassets/: images and gif used in this README
Requirements:
- Python 3.7+
- Windows or macOS for GIF export with
PIL.ImageGrab
Install dependencies:
pip install -r requirements.txtRun commands from src/:
cd srcTrain an agent:
python Pacman.pyThen select option 1.
Replay the best agent:
python Pacman.pyThen select option 2.
Replay a specific generation:
python Pacman.pyThen select option 3 and enter a generation (example: 042).
Tune hyperparameters:
python optimize.pyMain config file:
src/config/neat_config.txt
Important constants are in:
src/Pacman.py
- https://neat-python.readthedocs.io/en/latest/
- https://optuna.org/
- https://pypi.org/project/freegames/
- https://github.com/grantjenks/free-python-games
MIT License: LICENSE