Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lance Danzy Melinda Katanbafnezhad. The “A Mazing Problem” is a classical experiment from psychology where scientists carefully observe a rat going through.

Similar presentations


Presentation on theme: "Lance Danzy Melinda Katanbafnezhad. The “A Mazing Problem” is a classical experiment from psychology where scientists carefully observe a rat going through."— Presentation transcript:

1 Lance Danzy Melinda Katanbafnezhad

2 The “A Mazing Problem” is a classical experiment from psychology where scientists carefully observe a rat going through a maze. This experiment is performed repeatedly until the rat goes through the maze without going down a single dead end path. This demonstrates the rat’s learning curve. The computer program that does the same thing is not any smarter than the rat on its first try through, but the computer can remember the mistakes it made. The second time it runs through the maze it should go all the way through without going down dead ends. With a computer’s memory, and the right algorithm going through a maze is simple.

3  Using a recursive method every time a spot is visited, the method checks all surrounding spots for a path and marks what’s already been visited. If it reads in a point that is not a wall or marked as visited, it moves to that point. It will continuously do this until it has reached a mark indicating the end of the maze. If it reaches a dead end, it does not mark the point.

4  public bool labelPath(int startRow, int startCol) { //from the starting location specified by the parameters to the finis //is point in the maze boundaries if (startRow = rows || startCol = cols) { return false; } if (theMaze[startRow, startCol] == 'F') { // we are at the end of the maze return true; } // is point a valid path? if (theMaze[startRow, startCol] == ' ') { // mark this path just in case it works from here theMaze[startRow, startCol] = '-'; // find if there is a route past here  if (labelPath(startRow + 1, startCol) || labelPath(startRow - 1, startCol) || labelPath(startRow, startCol + 1) || labelPath(startRow, startCol - 1)) { // this is a good path! return true; } else { // this is not a good path - unmark it. theMaze[startRow, startCol] = ' '; } } return false; }

5 Wall Follower The best known rule for traversing mazes, also known as the left hand rule or the right hand rule. This method always keeps the wall on one side of the navigator, by doing this the navigator is guaranteed not to get lost and will reach an exit if there is one. http://www.youtube.com/watch?v=6cpQ3c-yd-s

6 Dead-end Filling This method looks at the entire maze once, finds all the dead-ends and then fills in the path from each dead end until there is a continuous path from start to finish. http://www.youtube.com/watch?v=yqZDYcpCGAI

7 Similar to how a GPS finds the shortest route to a destination, our algorithm determines the shortest path to the end of a maze, although a GPS may not necessarily use this algorithm and knows your location. If you ever find yourself trapped inside of a maze/labyrinth we recommend that you use a wall following method to escape, not recursion.

8  http://en.wikipedia.org/wiki/Maze_solving_algorithm http://en.wikipedia.org/wiki/Maze_solving_algorithm  Horowitz, E., Sahni, S., & Mehta, D. (1995). Fundamentals of Data Structures in C++. New York: W. H. Freeman & Co.  http://www.youtube.com/watch?v=yqZDYcpCGAI http://www.youtube.com/watch?v=yqZDYcpCGAI  http://www.youtube.com/watch?v=6cpQ3c-yd-s http://www.youtube.com/watch?v=6cpQ3c-yd-s


Download ppt "Lance Danzy Melinda Katanbafnezhad. The “A Mazing Problem” is a classical experiment from psychology where scientists carefully observe a rat going through."

Similar presentations


Ads by Google