Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NEAT-Pacman

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.

Demo

Trained agent replay:
Pacman agent replay

Fitness history:
Fitness history

Project structure

  • src/Pacman.py: game simulation, training, and replay
  • src/optimize.py: Optuna hyperparameter tuning
  • src/config/neat_config.txt: NEAT settings
  • src/outputs/: generated training and replay files
  • assets/: images and gif used in this README

Getting started

Requirements:

  • Python 3.7+
  • Windows or macOS for GIF export with PIL.ImageGrab

Install dependencies:

pip install -r requirements.txt

Usage

Run commands from src/:

cd src

Train an agent:

python Pacman.py

Then select option 1.

Replay the best agent:

python Pacman.py

Then select option 2.

Replay a specific generation:

python Pacman.py

Then select option 3 and enter a generation (example: 042).

Tune hyperparameters:

python optimize.py

Configuration

Main config file:

  • src/config/neat_config.txt

Important constants are in:

  • src/Pacman.py

References

License

MIT License: LICENSE

About

Python project where a Pacman agent learns to play the game using NEAT (NeuroEvolution of Augmenting Topologies) and neural networks. Includes full game simulation, agent training, replay visualization, and automated hyperparameter tuning with Optuna.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages