Objective: The objective of this lab is to gain experience using 2-dimensional a
ID: 3855445 • Letter: O
Question
Objective: The objective of this lab is to gain experience using 2-dimensional arrays, and algorithm development. Also, it will reinforce the concepts of loop structures, random number generation, functions, and text formatting This goal of this assignment is to simulate a robot negotiating a room. The first version will use a “random walk', algorithm which the "robot" in maze will just randomly wander until an exit is found. The second version will modified the original solution to block off any dead ends that the "robot" may find. The later version should result in shorter path (both time and distance wise) being found through the maze. Laboratory Checklist: » Review Random Number Generation » Review Two Dimensional C++ arrays » Read Problem Specification Create and Test a class called mazeSolver o You may find the functions names listed in the specification useful. o Use the filenames of amazing_ random _walk.cpp and amazing_intelligent.cpp for GITHUB submission. Submit Assignment to GIT under maze solver with containing » amazing_random walk.cpp, amazing_intelligent.cpp, and least three test maze files (all text files) Specification: You will be working extensively with a two dimensional character array in this assignment to simulate a robot navigating a series of rooms to an exit point. The robot at first will just be taught how to randomly walk around the room. The robot then will be given a more intelligent algorithm that allows the robot to avoid travelling in certain areas that the robot has travelled before (dead ends) You may want to review the Wikipedia article on maze solving First make sure you seed the random number generator in main). You only need to call srand0 once.Explanation / Answer
#include using namespace std; #include using std::setw; int main () { int n[ 10 ]; // n is an array of 10 integers // initialize elements of array n to 0 for ( int i = 0; i < 10; i++ ) { n[ i ] = i + 100; // set element at location i to i + 100 } coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.