This project implements various search algorithms to solve maze navigation problems for Pac-Man. Based on UC Berkeley's CS188 Introduction to Artificial Intelligence course, it demonstrates practical applications of algorithms like BFS, DFS, A*, and others in an AI pathfinding context. The implementation covers solutions to Questions 1-4 of Project 1 from the course.
- Breadth-First Search (BFS)
- Non-recursive Depth-First Search (DFS)
- Recursive Depth-First Search (DFS)
- Uniform-Cost Search (UCS)
- Greedy Search (GS)
- A* Search (with Manhattan distance heuristic)
To run the Pac-Man game with different search algorithms, use the command line interface as follows:
python pacman.py -l <layout> -p SearchAgent -a fn=<algorithm>layout: The maze layout you want to use. Examples include:tinyMazemediumMazebigMaze
algorithm: The search algorithm to apply. Options include:bfs: Breadth-First Searchdfs: Depth-First Search, non-recursiveastar,heuristic=manhattanHeuristic: A* Search, with manhattanHeuristicucs: Uniform-Cost Searchgs,heuristic=manhattanHeuristic: Greedy Search, with manhattanHeuristic
- Running BFS on a tiny maze:
python pacman.py -l tinyMaze -p SearchAgent -a fn=bfs
- Running A* search on a big maze with Manhattan distance heuristic:
python pacman.py -l bigMaze -p SearchAgent -a fn=astar,heuristic=manhattanHeuristic
Images and animations (GIFs) demonstrating the execution of these algorithms on different maze layouts are provided in the images and gifs folders.
- BFS solving mediumMaze
- UC Berkeley's CS188 Intro to AI course materials.
- The Pac-Man framework provided by the course staff.
- This repository does not contain the full answers and it is only developed as a coursework project.

