Question: Hello all, looking for some help with a homework question in C++. I have attached the question itself below. Anything helps! Thanks in advance You

Hello all, looking for some help with a homework question in C++. I have attached the question itself below. Anything helps!

Hello all, looking for some help with a homework question in C++.

I have attached the question itself below. Anything helps! Thanks in advance

You are required to design a class for the grid and submit

Thanks in advance

You are required to design a class for the grid and submit exactly three files: - maze.h : class declaration - maze.cpp : implementation of all methods defined in - main, cpp : driver program that takes CLAs and uses the class to generate output Your program will be compiled with the following line: $g++std=c++11-Wa11main.ppmaze.cpp=0generator - walls to be removed should be selected randomly. Use to generate random numbers and to provide a seed to the random number generator - there should be exactly one path connecting the starting and ending cells - every cell must be reachable from the starting cell The algorithm below should be followed in your implementation. This is not the most efficient way to solve the problem of maze generation, however it is easy to understand and can be implemented with the support of simple data structures such as dynamic arrays in (++). We strongly suggest you to trace this algorithm on paper using a small example (e.g. a 44 grid) until you fully understand how it works, before starting to code. create empty dynamic array " A " mark cell [0,0] as visited insert ce11 [,] at the end of ' A ' while ' A ' is not eapty 'current' \& - remove last element from 'A' 'neighbors' \&- "current''s neighbors not visited yet if "neighbors' is not empty Insert 'current' at the end of ' A " 'neigh' \& plek a randem neighbor from 'neighbors' remove the wall between 'current' and 'neigh' mark 'neigh' as visited insert "neigh' at the end of " A ' endif endichile In order to match the autograder tests, picking a random neighbor must follow this procedure: "check the neighbors of a cell in N-S-E-W order and append the ones that were not visited yet into an empty vector neighbors, then use the index idx below to pick a random neighbor with neighbors [idx] " \[ \text { id }=\text { std: }: \operatorname{rand}() /((\text { RANO_MaX }+1 \mathrm{u}) / \text { neighbors.size }()) \text {; } \] e Your Task Your goal in this assignment is to develop a command line tool that will generate a random maze, given some options provided by the user. Command Line Arguments Your program must accept the following command line arguments: (seed) the seed value for the randon number generator (N) number of rows in the grid N> M> number of cols in the grid M> fname file name for the output The seed argument is very important as it initializes the random number generator. If you change the seed, you will generate a different maze. In your code make sure you call this function exactly once before generating the maze: std: : srand(seed); The last argument will be used to save the generated maze into a text file. Note that you can provide any value as fname . See the example below: $./generator 1010 example.txt The file format for saving the maze is just a two dimensional array of integers, where each integer is used to represent a cell and its walls. Each integer in the matrix ranges from 0 to 16 . The idea behind this representation is that the walls are encoded using 4 bits, and the ingeters are just their corresponding values in decimal notation. The figure below illustrates the encoding: The file format for saving the maze is just a two dimensional array of integers, where each integer is used to represent a cell and its walls. Each integer in the matrix ranges from 0 to 16 . The idea behind this representation is that the walls are encoded using 4 bits, and the ingeters are just their corresponding values in decimal notation. The figure below illustrates the encoding

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!