Welcome to the Pac-Man Agent project! The aim of this project is to create an intelligent Pac-Man agent using machine learning techniques, specifically classification and regression, to predict Pac-Man's actions and future scores. This repository contains all the necessary files and instructions to get started and understand the project.
This project uses machine learning algorithms to create a Pac-Man agent that can play the game autonomously. The agent's actions are determined using a classification model, and its future score is predicted using a regression model. The main goal of this project is to develop an agent that can achieve a high score by following the optimal path to eat the ghosts while avoiding obstacles.To get started with the project, follow these steps:
- Clone the repository to your local machine:
$ git clone https://github.com/aaronespasa/pacman-ml-agent.git
$ cd pacman-ml-agent
- Install the required dependencies:
pip install -r requirements.txt
- Run the project:
$ python pacman.py
pacman-ml-agent
β
βββ RandomAgents.py
βββ busters.py
βββ bustersAgents.py
βββ bustersGhostAgents.py
βββ data
β βββ future
β βββ present
β βββ raw
βββ distanceCalculator.py
βββ filterFuture.py
βββ filterPresent.py
βββ game.py
βββ getting_dataset.sh
βββ ghostAgents.py
βββ grading.py
βββ graphicsDisplay.py
βββ graphicsUtils.py
βββ inference.py
βββ keyboardAgents.py
βββ layout.py
βββ layouts
βββ models
β βββ classification
β βββ prediction
βββ pacman.py
βββ projectParams.py
βββ textDisplay.py
βββ util.py
βββ wekaI.py
- Data Collection: Game data is collected using various maps and saved in the .arff format.
- Data Processing: The raw data is pre-processed and separated into present and future datasets.
- Model Training: Classification and regression models are trained using the processed data.
- Model Evaluation: The models are evaluated using the Experimenter in Weka.
- Model Selection: The best performing models are selected for implementation in the Pac-Man agent.
- Agent Implementation: The trained models are used to create an autonomous Pac-Man agent.
- J48
- IBK with K = 1
- RandomForest
- RandomTree
- K Star
The results were significantly improved (around 6%) after increasing the number of training instances.
The main challenge faced during this project was identifying the most relevant attributes for training a generalizable Pac-Man agent. A large number of tests were performed to find the best combination of instances, maps, attributes, training sets, and test sets. Despite the changes, the best performing algorithms remained consistent throughout the experimentation process.To overcome this challenge, we iteratively refined the feature set and experimented with various machine learning algorithms, eventually settling on a set of features and models that produced an agent with reasonable gameplay behavior. However, there is still room for improvement, and further research could potentially result in a more advanced and adaptable Pac-Man agent.
In conclusion, this project demonstrates the potential of using machine learning techniques to create an autonomous Pac-Man agent. By carefully selecting the features and algorithms, we were able to develop an agent that can achieve a high score in the game. This project serves as a stepping stone for future research and development in the field of game AI and machine learning.