Assume that a maze is a rectangular array of squares, some of which are blocked to represent walls.d

Assume that a maze is a rectangular array of squares, some of which are blocked to represent walls.d

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Assume that a maze is a rectangular array of squares, some of which are blocked to represent walls To Purchase This Material Click below Link - maze-is-a-rectangular-array-of-squares-some-of-which-are-blocked- to-represent-walls FOR MORE CLASSES VISIT Do you know how to find your way through a maze? After you write this program, you will never be lost again! Assume that a maze is a rectangular array of squares, some of which are blocked to represent walls. The maze has one entrance and one exit. For example, if x ’s represent the walls, a maze could appear as follows: xxxxxxxxxxxxxxxxxx x x x xxxx x x xxxxx xxxxx xx x x xxxxx xxxxxxx xx x x x xx xx x x xxxxxxxxxx xx x xxxxxxxxxxxx o xxxxxxx A creature, indicated in the previous diagram by o , sits just inside the maze at the entrance (bottom row). Assume that the creature can move in only four directions: north, south, east, and west. In the diagram, north is up, south is down, east is to the right, and west is to the left. The problem is to move the creature through the
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
maze from the entrance to the exit (top row), if possible. As the creature moves, it should mark its path. At the conclusion of the trip through the maze, you should see both the correct path and incorrect attempts. Write a program to solve this problem. Squares in the maze have one of several states: CLEAR (the square is clear), WALL (the square is blocked and represents part of the wall), PATH (the square lies on the path to the exit), and VISITED (the square was visited, but going that way led to an impasse).
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern