Skip to content

63731-coder/Pacman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Pac-Man AI Project

Description: This project is a mini-laboratory assignment for the 4ALGL4A course where students implement rational agents to play Pac-Man. The goal is to explore artificial intelligence concepts such as reflex agents, adversarial search (Minimax), alpha-beta pruning, and Expectimax in a controlled Python 3 environment using Tkinter for the graphical interface.


Repository Structure

.
├── pacman.py              # Main game script
├── graphicsDisplay.py     # GUI display
├── graphicsUtils.py       # GUI helper functions
├── textDisplay.py         # Text-based display
├── game.py                # Game state definitions
├── util.py                # Utility functions
├── projectParams.py       # Program parameters
├── layouts/               # Maze layout text files
├── layout.py              # Layout loader
├── keyboardAgents.py      # Human-controlled agent
├── ghostAgents.py         # Ghost AI agents
├── pacmanAgents.py        # Sample agents: LeftTurnAgent, GreedyAgent
├── multiAgents.py         # Your rational agents: ReflexAgent, MultiAgentSearchAgent, MinimaxAgent, AlphaBetaAgent, ExpectimaxAgent

Agents Overview

  1. ReflexAgent – Evaluates the immediate effect of each action and chooses the best.
  2. MultiAgentSearchAgent – Base class for agents considering other agents' potential moves.
  3. MinimaxAgent – Implements the Minimax algorithm for adversarial search.
  4. AlphaBetaAgent – Optimized Minimax with alpha-beta pruning.
  5. ExpectimaxAgent – Uses expected values for ghost actions instead of worst-case scenarios.

Each agent has two main methods: get_action(self, game_state) and evaluation_function(self, current_game_state, action).


Usage

  1. Run the game with a human agent:
python pacman.py
  1. Run with ReflexAgent:
python pacman.py -p ReflexAgent
  1. Run with MinimaxAgent (depth 4):
python pacman.py -p MinimaxAgent -l minimaxClassic -a depth=4
  1. Run with AlphaBetaAgent (depth 3):
python pacman.py -p AlphaBetaAgent -l smallClassic -a depth=3
  1. Run with ExpectimaxAgent (depth 3):
python pacman.py -p ExpectimaxAgent -l minimaxClassic -a depth=3

Use --help to see all options:

python pacman.py --help

Goals

  • Implement rational agents for Pac-Man.
  • Apply Minimax, Alpha-Beta pruning, and Expectimax algorithms.
  • Improve evaluation functions to enhance agent performance.
  • Test agents on various maze layouts and ghost configurations.

References

This repository is for educational purposes and course submission only.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages