GitXplorerGitXplorer
a

pacman-rl

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
cd7ca425240cc3a21d5245e01726d3388b0aadae

remove print statement

aallerter committed a day ago
Unverified
b3ac6b9f10be13b463eeea7b0e63de3bc0b9885d

fix loading dqn model

aallerter committed a day ago
Unverified
87cfdf23baea55781a986bef6f69ef16c6e0cc14

fix detecting level when playing from model

aallerter committed a day ago
Unverified
b0f7dc06311fc2fdae3a63e74c793abd54f255ee

fix tensorflow not available for installation

aallerter committed a day ago
Unverified
637969cd692d80eeed8e7fcf8098d1ede9e4c3af

Remove extra file

aallerter committed a day ago
Unverified
00cfd995fcada143d53a2b88ad0528ef106409bd

Add pdf file

aallerter committed a day ago

README

The README file for this repository.

ManPac: Reinforcement Learning for Pac-Man

This readme contains information regarding the project structure and runtime instructions.

Project structure

The project structure is as follows:

pacman-rl/

├── models/
├── notebooks/
├── src/
├── environment.yml
├── README.md

The project structure includes several key folders and files:

  • notebooks: Contains Jupyter notebooks
  • src: Holds the source code
  • models: Stores models' information
  • environment.yml: Creates a conda environment with necessary packages
  • README.md: Provides project information

Installation

To install the necessary packages, use the provided conda environment file. First, make sure you have conda installed. If you don't have it installed, you can download it from here.

To create a new conda environment from the environment file, use the following command to install requirements:

conda env create -f environment.yml
conda activate PacmanOpenAIGym_FHDortmund
pip install tensorflow==2.18.0

To activate the environment, use:

conda activate PacmanOpenAIGym_FHDortmund

If you're using an IDE like PyCharm or VSCode, you have to select the environment in the IDE settings.

Running Jupyter Lab

Instead of using Jupyter notebooks, we recommend using Jupyter Lab. To run Jupyter Lab, use the following command:

jupyter lab

The cell should then output a link that you can open in your browser to access Jupyter Lab. Check the output in the terminal for the link. It should look something like this:

http://localhost:8888/lab?token=aa7e97c2d09bae01632db508730ab48cbc4609fc92c7fc6e

The token can vary, so make sure to use the one provided in the output.

Models

The models folder contains all the useful information for each different model and level of the game.

The training_plots folder contains plots of different hyperparameter combinations and their respective rewards.

Using the training plots, for each level fine-tuned hyperparmeters have been saved in the hyperparameters.ini file which you can easily copy and replace with the one in the src folder to train and play the model.

Finally, each level folder also has a saved model (with the .pkl extension) that you can easily load up and have it play any level.

Usage

First of all, activate the environment:

conda activate PacmanOpenAIGym_FHDortmund

To train a model and play the game, first set the desired level and model hyperparameters in src/gym-pacman-environment/hyperparameters.ini (for Dyna-Q you can omit the hyperparameters after discount_factor). Then run the src/gym-pacman-environment/train_and_play.py file.

python src/gym-pacman-environment/train_and_play.py

To play from a saved model, open src/gym-pacman-environment/play_saved_model.py, adjust the filename variable, and then run the file.

© 2025 Hazhir Amiri, Raed Kayali, Lucas Schönhold,