Skip to content

Nickiller/pacman

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pacman

A semester-long artificial intelligence class project to design a search agent to play Pacman effectively.

The search directory contains implementations of a search agent for finding the best path through a maze. To run it, go to the search directory and run:

python pacman.py -l [name of maze] -p [search agent to use]

where your choices of maze are enumerated in search/layouts and the choices of search agents are GoWestAgent, which just goes west (not that useful); StayEastSearchAgent, which prefers the east side of the maze; StayWestSearchAgent, which prefers the west side of the maze; AStarCornersAgent, which tries to reach each corner in as few total moves as possible; AStarFoodSearchAgent, which tries to collect all the food pellets in the maze in as few moves as possible; ClosestDotSearchAgent, which greedily goes for the nearest dot at all times; and ApproximateSearchAgent, which is used on larger mazes because unlike the other agents, it does not always choose the perfect route but rather the best route it could calculate quickly.

The reinforcement directory contains implementations of agents that use Q-learning in modeling Pacman as a Markov decision problem to play a fully-realized game of Pacman. To see it in action, go to the reinforcement directory and run:

python pacman.py -p PacmanQAgent -x 2000 -n 2010 -l smallGrid python pacman.py -p PacmanQAgent -x 2000 -n 2010 -l smallGrid

Also, there is an approximate Q-learning agent that runs much faster than the idealized one above, with the result that it can operate on larger mazes on reasonable timescales. To see that one in action, run in the reinforcement directory:

python pacman.py -p ApproximateQAgent -a extractor=SimpleExtractor -x 50 -n 60 -l mediumClassic

Wow. Isn't that amazing? I think it is.

Finally, the tracking directory solves a slightly different problem. In this version of the game, Pacman is supposed to find and eat ghosts that are invisible. To do this, he uses a particle filter, receiving inputs that tell him the distance to each ghost with a certain degree of noise and using this information to calculate the ideal path. To see it in action, cd into tracking and run:

python busters.py -p BustersAgent

Thanks for playing!

About

A semester-long artificial intelligence class project to design a search agent in Python to play Pacman effectively.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published