Presentation is loading. Please wait.

Presentation is loading. Please wait.

DUE: WEDNESDAY, FEBRUARY 29 PRESENTED BY: JAMES AHLUM CSE 348 AI Game Programming Project 2: Pathfinding in Games.

Similar presentations


Presentation on theme: "DUE: WEDNESDAY, FEBRUARY 29 PRESENTED BY: JAMES AHLUM CSE 348 AI Game Programming Project 2: Pathfinding in Games."— Presentation transcript:

1 DUE: WEDNESDAY, FEBRUARY 29 PRESENTED BY: JAMES AHLUM CSE 348 AI Game Programming Project 2: Pathfinding in Games

2 The Framework Pac-Man  Developed at UC Berkeley  Very well tested and documented  The instructions are excellent  We will focus on the search application of the framework

3 The Project Search in Pac-Man 5 Tasks  Depth-first Search  Breadth-first Search  A* Search  Transition Tables  A* Food Search  Find a path to eat all dots in the map as fast as possible  In-class competition to determine the winner

4 Setup Download the Pac-Man Framework  You can get the zip file here or from the websiteherewebsite  Unpack the zip file and store it in your desired location Download Python  You want Python version 2.7.2  Download it for various OS herehere  Select the desired installation location  Default for Windows is C:\Python27

5 Setup Add Python to your Path  Windows: Computer > Properties > Advanced System Settings > Environment Variables (under Advanced Tab)  Find “Path” under System Variables > Edit it and *APPEND* C:\Python27 (or the directory where you installed Python)  Note: Do not replace the Path variable with C:\Python27, just append it using a semicolon You should now be able to invoke the Python interpreter from the command line  Open a Command Prompt, switch to the “search” directory where you unpacked the zip file  Type “python pacman.py” to test your setup  It should open a GUI where you can use arrow keys to control Pac-Man

6 Development Pseudocode for the algorithms will be presented in the next lecture The only files you should need to edit are search.py and searchAgents.py  They are well commented and make it very clear where your code needs to go An important note from the project website:  “Each algorithm is very similar. Algorithms for DFS, BFS, and A* differ only in the details of how the fringe is managed. So, concentrate on getting DFS right and the rest should be relatively straightforward.”

7 Development I recommend using the data structures in util.pyutil.py  Stack will be useful for depth-first search  Queue will be useful for breadth-first search  Priority Queue will be useful for A* If you don’t know Python, learning it might take some time  The Pac-Man projects has a tutorial that goes over the basics and key things you’ll need to know for this projecttutorial  There’s also an official Python tutorial and full documentationofficial Python tutorialdocumentation

8 Python Data Structures  Lists: list = [2, ‘a’, “string”], list[0] == 2  Tuples: pair = (1,2), pair[0] == 1  Sets: mySet = set(), mySet.add(1), 1 in mySet == True  Dictionaries (associative arrays): f = {}, f[state] = 1.0, where state = (x,y) Finding the length of a structure  len(“abc”) == 3, len(list) == 3 Comments:  #single line comment, “””multi line comment”””

9 Debugging Print to the command prompt  print “message”  for state in answer: print str(state)  Notice the str() method to print string representation Log to a file  file = open(‘log.txt’, ‘w’)  file.write(‘log message \n’)  file.close()

10 Deliverables Code  Email search.py and searchAgents.py to jfa306@lehigh.edu by midnight, Wednesday, February 29jfa306@lehigh.edu  If you create any additional files (i.e. for your own data structures) or modify any existing files, also send those along with a detailed description of the additions/modifications Presentation & Report  As explained in the project description, due Thursday, March 1

11 That’s All Questions?  Email jfa306@lehigh.edu with CSE348 in the subject, CC munoz@cse.lehigh.edujfa306@lehigh.edu munoz@cse.lehigh.edu


Download ppt "DUE: WEDNESDAY, FEBRUARY 29 PRESENTED BY: JAMES AHLUM CSE 348 AI Game Programming Project 2: Pathfinding in Games."

Similar presentations


Ads by Google