Giter VIP home page Giter VIP logo

pac-man's Introduction

Pac-man

In this project I am going to illustrate the following using our beloved Pac-man game :
  1. Search algorithms (DFS, BFS, UCS, A*)

Instructions

Clone or download the entire package and follow instructions to run the program in your system. Make sure you have installed Python 3.7 or higher . To play the game just run the following command in command line:

python pacman.py

Visualizaton of Search algorithms (DFS, BFS, UCS, A*):

AI.Assignment.mp4

Pacman lives in a shiny blue world of twisting corridors and tasty round treats. Navigating this world efficiently will be Pacman's first step in mastering his domain.
Here Pacman agent will find paths through his maze world, both to reach a particular location and to collect food efficiently using following algorithms:

  1. Depth First Search
  2. Breadth First Search
  3. Uniformed Cost Search
  4. A* Search

The codes are present in the following python files:

  1. search.py : Where all of the search algorithms reside.
  2. searchAgents.py : Where all of the search-based agents reside.

The simplest agent in searchAgents.py is called the GoWestAgent, which always goes West (a trivial reflex agent). This agent can occasionally win:

python pacman.py --layout testMaze --pacman GoWestAgent

But, things get ugly for this agent when turning is required:

python pacman.py --layout tinyMaze --pacman GoWestAgent

The missions is to solve the problem not only for tinyMaze but for all the mazes:

  1. tinyMaze
  2. mediumMaze
  3. bigMaze

Use the following command to excecute the algorithms (DFS, BFS, UCS, A*) to solve the path finding problem for any kind of maze mentioned above. Just edit the maze name and fn value (i.e. dfs, bfs, ucs, astar).
Note: Heuristic is only used in case of A* algorithm
python pacman.py -l <maze name> -p SearchAgent -a fn=<dfs or bfs or ucs or astar> ,heuristic=manhattanHeuristic

Example: mediumMaze and bfs algorithm:

python pacman.py -l mediumMaze -p SearchAgent -a fn=bfs ,heuristic=manhattanHeuristic

Use the following command for more complex problem (requires more computation) :

python pacman.py -l testSearch -p SearchAgent -a fn=astar, prob=FoodSearchProblem, heuristic=foodHeuristic

pac-man's People

Contributors

ghoshavirup0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.