If no 'S' is found in the maze return -1 as both the x and y coordinates. You may assume that at most one such character exists in the maze. Test your code with different mazes before proceeding.īefore you can solve the maze you need to find the starting point! Add a function to your code called findStart() that will search the maze (character-by-character) and return the x and y coordinate of the 'S' character. Next write a function that prints out the maze in a much nicer format:Į.g., # In order to make the next question simpler you may make this list a global variable. Note that the lists have been stripped of all '\r' and '\n' characters. Your objective for this question is to load any given maze file, and read it into a 2-dimensional list.Į.g.: loadMaze("somemaze.maze") should load the somemaze.maze file and create a list like the following. You may use this sample maze or create your own. For this assignment you will use a simple text format for the maze. You are going to create a maze crawler capable of solving any maze you give it with the power of recursion!īefore you can solve a maze you will have to load it. """Returns True if word is a pallindrome, False otherwise""" Return fib(n-1) + fib(n-2) #recursive case I'm not asking for anyone to write the code, I'm just hoping some explanations would put me on the right path. The professor didn't explain recursion that much, he gave us examples of recursion, which I will post, but I was hoping someone might be able to give me a more in depth explanation of the recursion, and how I would apply this to solving a maze. I will post the assignment guidelines so you can see what I am talking about. So, I have an assignment which asks me to solve a maze using recursion.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |