Skip to content

Build an intelligent Pac-Man agent using A*, LPA* and Q-Learning.

License

Notifications You must be signed in to change notification settings

kevinyang372/pac-man-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pac-Man Solver

Build an intelligent Pac-Man agent using A*, LPA* and Q-Learning. Astar solver

Example Usage

All algorithms in the repository could be used as a python package. If using custom maps, please save the map as a txt file and input the filename as the parameter.

from astar import Astar
from q_learning import QLearning
from LPA import LPA

# initialize solver class
astar = Astar(ghostsPosition = set([(5, 3)]), treasuresPosition = [(1, 7), (6, 0)])
lpa = LPA(ghostsPosition = set([(5, 3)]), treasuresPosition = [(1, 7), (6, 0)])
qlearner = QLearning(ghostsPosition = set(), iterations = 1000)

# q-learning needs to be trained first
qlearner.train()

# return a solution
path_astar, maps_astar = astar.astar_solve()
path_lpa, maps_lpa = lpa.LPA()
path_q, maps_q = qlearner.move()

About

Build an intelligent Pac-Man agent using A*, LPA* and Q-Learning.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published