Skip to content

Vvkmnn/pacmanAI

Repository files navigation

pacmanAI

Another lab in the Artificial Intelligence Nanodegree program, that creates agents to play through Pacman!

To do this, we had to define code dealing with Depth-First Search, Breadth-First Search, Uniform-Cost Search / Cheapest-First, and the venerable A* Star Search which uses a combination of cost and a heuristic to further improve our Pacman's performance.

Please note that the majority of this code is not mine, and is maintained by the amazing guys over at Berkely, and brought to my attention by Udacity. search.py specifically has been modified to include my own attempts at solving this project.

The full Pacman project and details are available from Berkley.

Setup

This project requires Python 2 (Preferably as distributed by Anaconda) and can be visaluzed via Pygame to get a visualization like the one above.

After setting up (and jumping in the environment), this project can be run via the following commands:

No Search

    python2 pacman.py
    python2 pacman.py --layout testMaze --pacman GoWestAgent
    python2 pacman.py --layout tinyMaze --pacman GoWestAgent
    python2 pacman.py -h

Regular Search

    python2 pacman.py -l tinyMaze -p SearchAgent -a fn=tinyMazeSearch
    python2 pacman.py -l tinyMaze -p SearchAgent
    python2 pacman.py -l mediumMaze -p SearchAgent
    python2 pacman.py -l bigMaze -z .5 -p SearchAgent
    python2 pacman.py -l mediumMaze -p SearchAgent -a fn=bfs
    python2 pacman.py -l bigMaze -p SearchAgent -a fn=bfs -z .5
    python2 eightpuzzle.py
    python2 pacman.py -l mediumMaze -p SearchAgent -a fn=ucs
    python2 pacman.py -l mediumDottedMaze -p StayEastSearchAgent
    python2 pacman.py -l mediumScaryMaze -p StayWestSearchAgent

Heuristic Search

    python2 pacman.py -l bigMaze -z .5 -p SearchAgent -a fn=astar,heuristic=manhattanHeuristic 
    python2 pacman.py -l tinyCorners -p SearchAgent -a fn=bfs,prob=CornersProblem
    python2 pacman.py -l mediumCorners -p SearchAgent -a fn=bfs,prob=CornersProblem
    python2 pacman.py -l mediumCorners -p AStarCornersAgent -z 0.5
    python2 pacman.py -l testSearch -p AStarFoodSearchAgent
    python2 pacman.py -l trickySearch -p AStarFoodSearchAgent
    python2 pacman.py -l bigSearch -p ClosestDotSearchAgent -z .5 
    python2 pacman.py -l bigSearch -p ApproximateSearchAgent -z .5 -q 

About

🎮 A set of artificially intelligent Pacman agents, using different search strategies!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages