Question: Solving a Maze(stacks) NEED HELP SOLVING MazePath.h: #include #include #ifndef MAZEPATH_H #define MAZEPATH_H class MazePath { public: const static std::string DIRECTIONS; const static std::string COMPLEMENTS;
Solving a Maze(stacks) NEED HELP SOLVING

MazePath.h:
#include #include #ifndef MAZEPATH_H #define MAZEPATH_H class MazePath { public: const static std::string DIRECTIONS; const static std::string COMPLEMENTS; //CONSTRUCTORS MazePath(); MazePath(std::string steps); //takes a step further into the maze void takeStep(char step); //returns the sequence of steps to get back to the starting point std::string directionsOut(); //overloaded output operator friend std::ostream& operator MazePath.cxx
#include "MazePath.h" #include #include #include using namespace std; const string MazePath::DIRECTIONS = "NSEW"; const string MazePath::COMPLEMENTS = "SNWE"; MazePath::MazePath() { } MazePath::MazePath(string steps) { for (int ndx = 0; ndx MazePathTest.cpp
#include "MazePath.h" #include #include using namespace std; int main () { //Testing isValid function with valid strings cout Maze.h
#include #ifndef MAZE_H #define MAZE_H class Maze { public: static const char EMPTY = '.'; static const char BLOCKED = 'X'; static const char START = 'S'; static const char END = 'G'; // Creates a Maze with no blocked cells; start = (0, 0); goal = (SIZE, SIZE) Maze(); // Puts obstacle on the cell (row, col) void blockCell(int row, int col); // is position (row, col) clear? bool isClear(int row, int col) const; // returns the size of the Maze int size() const; // clear the maze: erase all obstacles void clearAllCells(); // sets the end cell to (col, row) void setEndCell(int row, int col); // sets the start cell to (col, row) void setStartCell(int row, int col); // find a path from S to G by backtracking std::string solveBacktracking(); // overloaded output operator friend std::ostream& operator Maze.cxx:
#include "Maze.h"
#include using namespace std; // Creates a Maze with no blocked cells; start = (0, 0); goal = (SIZE, SIZE) Maze::Maze(){ for (int row = 0; row Download the starter code for this part of the project and make sure you understand the Maze class. FILES: Maze.cxx, Maze.h TASK 1. Write a client program (Maze Client.cpp) to create the following maze as an object of the Maze class: TASK 2. Implement the soveBacktracking the algorithm above. member function of the Maze class Maze.cxx). Use TASK 3. Solve the maze created in TASK1 using the solveBacktracking function. NOTE: You might need to add functions to the Maze class, depending on how you approach the solution. Add/modify the class as needed. But do not repeat functionality. Use the functions that Download the starter code for this part of the project and make sure you understand the Maze class. FILES: Maze.cxx, Maze.h TASK 1. Write a client program (Maze Client.cpp) to create the following maze as an object of the Maze class: TASK 2. Implement the soveBacktracking the algorithm above. member function of the Maze class Maze.cxx). Use TASK 3. Solve the maze created in TASK1 using the solveBacktracking function. NOTE: You might need to add functions to the Maze class, depending on how you approach the solution. Add/modify the class as needed. But do not repeat functionality. Use the functions that Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
