C++ with cygwin The maze size needs to be 20 and look like this: I need help finding the solution to this as I am stuck

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

C++ with cygwin The maze size needs to be 20 and look like this: I need help finding the solution to this as I am stuck

Post by answerhappygod »

C++ with cygwin
C With Cygwin The Maze Size Needs To Be 20 And Look Like This I Need Help Finding The Solution To This As I Am Stuck 1
C With Cygwin The Maze Size Needs To Be 20 And Look Like This I Need Help Finding The Solution To This As I Am Stuck 1 (42.9 KiB) Viewed 21 times
The maze size needs to be 20 and look like this:
C With Cygwin The Maze Size Needs To Be 20 And Look Like This I Need Help Finding The Solution To This As I Am Stuck 2
C With Cygwin The Maze Size Needs To Be 20 And Look Like This I Need Help Finding The Solution To This As I Am Stuck 2 (13.83 KiB) Viewed 21 times
I need help finding the solution to this as I am stuck figuring
out finding the shortest exit with recursion.. please label each
file too(maze.cpp, maze.h, test.cpp), it'll help!
In this homework you will be combining use of recursion as well as a bit of oo design. What you should provide: Two cpp files and a .h file maze.cpp - the Implemtation for the Maze and Maze Elements maze.h - header file test.cpp - Test driver that reads in the 'maze' data file and drives the test The assignment (just the bare bones) ( suggestions and hints follow) You are given a maze represented by a data file. At the top of the file are two integers which is the row and column values for the array Next are two integers which provide the starting point of your search. Walls are noted by a '#' mark. You may move to any space which is not a '#' and that does not take you outside of the map The objective is to find a shortest path through the maze to the exit ( noted on the map by a 'o' character) You may move up/down/left/right (but not on a diagonal) Then you will print out the maze. For example if this is the data file

非會非非非,非非非非非非非非非非非非志 井,井井井非非非非 #########带书 #.# #。#。 # #. #.#.# * * ##### b, ##### 20 20 11 ##### . # . 15. Here is a possible output file 非帮帮主 ELE 非非 FE #, # ### 井草本 HE ##.#### 主 FF *** ####### By possible - I mean that there may be other paths as short - but none shorter.

I would suggest some kind of MazeElement class, and a Maze class A MazeElement could be a floor, wall, etc. Read in the size of the maze, and the starting point coordinates Initialize some data structure to hold a 2D array of MazeElements Read in the maze data file named 'maze') one row at a time. Look at each character in the maze file and initialize the appropriate MazeElement instance A suggested code sample for reading in code and examining characters. !! Open the file an get the istream istream&stream; stream >> numrow; // numrow, numcol, startRow, Startcol 11 clean up the input line ( get rid of the final \n) string line; getline stream, line): 1/ get the line and parse it one char at a time. getline stream, line) for (j = 0; j < numcol : j++) { char val = line.data[j]: // Init element using char } Once you get the internal maze data structure set up, you probably want to print the maze so you can feel confident there are no issues. Solving the maze an Analogy: You are an adventurer in a deep dark dungeon. You are surrounded by paths and walls. You will need to use your programming skills to find the shortest path out of the dungeon. The wizard has given you a rabbit to help you in your quest. The rabbit will explore all of the places that he can access and will help you in your quest. You will send the rabbit off in some direction (N, E, S, W) The rabbit may hit a wall in which case he will return. The rabbit may realize that she is at the edge of the maze in which case it will not proceed The rabbit counts the number of hops it has taken from the starting point (One hop = 1 room) When the rabbit gets to a room :

################### u 非 非非非非非 非非非非 20 20 1 1 井井井 非 非 非非非非非书 =# # # # # 非非非 # 书 井 # #### # 非非非非非非非非非非非非非非非非非非非非
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply