Lab 5 and Lab 6
July 14-15
Lab 5
I will be posting some notes for Wednesday, and a sample test. I will do one heap lecture this week and the rest of the time we
will work on these graphing problems.
Lab 5 - Project (covering Thursday's lab and lecture)
I am giving you a zipped file for the maze competition. In the maze competition there are some simple one correct path mazes. The program will read in the maze files and then display the start character.
The program automatically finds the start area and gives you the startX, startY and facing values. You then have to move down the hallways and find the end.
You need to keep track of which way you are facing (south, east, west, north) as a String and you're x, y coordinates. Send the information to the drawing method and it will draw you're character for you in the map. Each step and turn you take in the maze should be drawn. You can't go through walls which are the cactus and rocks in the graphics, only hallways which are dots in the text file.
Here is a link to an old assignment in 221 where the students figured out how to traverse the maze. Explanation
You're program will get three runs at the final maze in the timed event. Between each run we will shutdown the program and start it back up. Anything you want to remember from your first run through the maze will need to be saved to a file and read in when you start the program back up. In that method before the exit is called you must save your information.
Their might be more than one correct path through the maze. One will be shorter than the other path (if their are multiple tours).
Use shortest path strategies to be able to decrease your time each time through the maze.
Make up your own example mazes to help you strategize.
Try not to mess with any of my code, the user typing a 1 will start
calling the solve method, and the windows x button will call the method
that kills the
program. Grading
I'm giving you until Thursday's lab after the test to complete this project.
Your ability to better your time, solve the problem, and program creatively will all be factors of your grade.
The competition will be Thursday's lab.
Source Code
I went ahead and posted the recursive solution that solves the maze using
right hand rule.
Now you make it find the shortest path, create your own graphs.
maze223.zip
I put comments, many comments, you need to leave all the timing stuff and
mess with the stuff in the solve method and the closingMethod.
I have the timer set to 50000, which is 50 seconds.
Lab 6 - Advanced solving of the maze
For this lab you will actually use a robot to solve the maze the same way you did above, except using the actual sensors, wheels and
a feeling for direction.
Tomorrow I will show you examples of the robots, the Java Robot API and how to communicate with the sensors.
This problem is not trivial with a robot, it will be difficult and frustrating, but it is a true test of graph problem solving.