


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Due Date: Thursday, September 28, 10PM
For this programming, you will write a program to play the game Rushhour. We’ve provided some code infrastructure in Lisp and test files. Please start early. While not a large amount of code is required for the final solution, you will need time for running and debugging, so plan accordingly!
Note: Code available from http://www.cs.umd.edu/class/fall2006/cmsc421/projects/pa1.tar.
In this game, your goal is to drive a designated vehicle (represented by the letter R) out of the traffic jam and escape to freedom. To do so, you must maneuver all the blocking cars and trucks out of your way.
You can gain some intuition on how to solve this problem by playing web-based version of the game at: http://www.puzzles.com/products/RushHour/RHfromMarkRiedel/Jam.html http://gamerival.grab.com/index.cfm?game=6389B19F Note that the first url works properly using Internet Explorer, but not Firefox.
A 6x6 grid describes the traffic world. All vehicles occupy either 2 or 3 grid squares. A vehicle can only move along its axis of orientation (i.e. horizontal vehicles can only move left and right, verticle vehicles can only move up and down). The idea is to have the R car reach the state where it can exit the grid.
Example: Take a look at the test file test2. In this puzzle, there is one other vehicle in addition to your vehicle R. (Spaces marked NIL are empty.) In order to solve the puzzle, v1 needs to be moved down one step, and then R needs to be moved to the right one step. When R reaches the end of the row, the goal has been achieved.
Note: The red vehicle always starts somewhere in the 3rd row (i.e. x=2 in a 0-based array), and must move off the board to the right. Also, assume the car can only move one space at a time to any direction.
Vehicles (other than your red car) must stay on the board.
You will use depth-first (dfs), breadth-first search (bfs) and A* to solve the RushHour game. Your function should find a solution if one exist.
Copy the code, rush-hour-basics.lisp, to your directory. Read the documentation in the file thor- oughly. A couple of notes on the code:
is bound to T, which sends messages to standard output (i.e., the screen). You can send this output to a file by using open-debug with the name of the file. When you close the logging/debugging file with close-debug, it will revert to sending messages to standard output.
The test cases are test1, test2, test3 and test4. Extra credit would be given if it works for test4. test0 is in the goal state.
(a) [15 points] Extra credit if you try more than one heuristic and compare results in your writeup. (b) [15 points] Extra credit if you also try greedy best-first search. (c) [15 points] Extra credit if you include results for test4.
The deliverables of this project is a single tar file, your-glue-id.tar, must contain the following files.
You’re done! :-) (modulo testing, gathering results, debugging, getting rid of the infinite loops...)