Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have no idea how to do this can anyone help. I need in c# You must write a program to traverse a 12 x

I have no idea how to do this can anyone help.

I need in c#

You must write a program to traverse a 12 x 12 maze and find a successful path from a starting point to an exit. You are given a hard coded maze in the program, as well as some starting coordinates.

Each spot in the maze is represented by either a '#' or a '.' (dot). The #'s represent the walls of the maze, and the dots represent paths through the maze. Moves can be made only up, down, left, or right (not diagonally), one spot at a time, and only over paths (not into or across a wall).

The exit will be any spot that is on the outside of the array. As your program attempts to find a path leading to the exit, it should place the character 'X' in each spot along the path. If a dead end is reached, your program should replace the Xs with '0'. But, the spots with '0' should be marked back to 'X' if these spots are part of a successful path leading to a final state.

The output of your program is the maze configuration after each move. In your testing, you may assume that each maze has a path from its starting point to its exit point. If there is no exit, you will arrive at the starting spot again.

In addition to solving the maze as is, I want you to also solve the transposition of the maze. There is a method stub in the main program for transposing the 2D array. This method is just that, a stub. You need to fill out the code to make that transpose method work. The program is already setup to solve both the original maze, and the transposed maze. Your program should be able to solve both of them without any issue.

You are required to use recursion to solve this problem.

{

{ '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' },

{ '#', '.', '.', '.', '#', '.', '.', '.', '.', '.', '.', '#' },

{ '#', '.', '#', '.', '#', '.', '#', '#', '#', '#', '.', '#' },

{ '#', '#', '#', '.', '#', '.', '.', '.', '.', '#', '.', '#' },

{ '#', '.', '.', '.', '.', '#', '#', '#', '.', '#', '.', '.' },

{ '#', '#', '#', '#', '.', '#', '.', '#', '.', '#', '.', '#' },

{ '#', '.', '.', '#', '.', '#', '.', '#', '.', '#', '.', '#' },

{ '#', '#', '.', '#', '.', '#', '.', '#', '.', '#', '.', '#' },

{ '#', '.', '.', '.', '.', '.', '.', '.', '.', '#', '.', '#' },

{ '#', '#', '#', '#', '#', '#', '.', '#', '#', '#', '.', '#' },

{ '#', '.', '.', '.', '.', '.', '.', '#', '.', '.', '.', '#' },

{ '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' }

};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions