Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

The task is described in first pic but you have to implement as per 2nd pic using classes.I upload first pic to give background.Implement in

The task is described in first pic but you have to implement as per 2nd pic using classes.I upload first pic to give background.Implement in C++ using Object Oriented Programming.Do not use vectors.

image text in transcribedimage text in transcribed

Consider a robot that intends to finds its way through a maze. The maze can be represented by a 2-D array. A free cell is represented by a value 0 and a cell with obstacle is represented by a value 1. If the start and end points are known, develop a function that can evaluate, given a set of moves that define the path from start to end, whether a successful path is found or not. A move can be described with the help of number of steps to be taken in a specific direction. For instance: r10 means move ten steps right, while u2 means move two steps up. A robot can cover 1 free cell in 1 step, but cannot cross a cell with obstacle. Movement is possible in four directions: left, right, up, down, each represented by 1,r,u,d respectively. A successful path is a set of moves from start to end such that no obstacle is encountered in between. A maze can be of size MxN and its structure shall be read from a file along with start and end point. A sample file format along with description is illustrated in the table below: Size of maze 6x9 Structure of maze 111111111 001010001 101010101 100000100 110111011 100000001 1,0 Start point End point 3,8 Path can be input on console using standard input (cin), comprising of each move separated by -> For instance, sample inputs and outputs are illustrated in the following table: Sample Output Sample Input r1->d2->r4->u2->r2->d2->r1 r1->2->r7 true false rl->d2 Page 1 / 1 - + false Re-implement your assignment-1 (path evaluation in a maze) using Object-oriented approach. Consider the following classes: Grid: A cover to create a dynamically created 2-D array Maze: A specialized Grid containing obstacles as well as a start and end point Move: An abstraction to represent movement over the grid defined by direction and number of steps Path: A sequence of moves The movement is possible in all the four directions but only 1 free cell can be covered in one step and no cell with obstacle can be crossed. The goal is to evaluate whether a path is successful or not. A successful path is a set of moves from start to end such that no obstacle is encountered in between. A simple illustration is given in the table below: Size of maze Structure of maze 6x9 111111111 001010001 101010101 100000100 110111011 100000001 1,0 3,8 Start point End point Path can be input on console using standard input (cin), comprising of each move separated by -> For instance, sample inputs and outputs are illustrated in the following table: Sample Input r1->d2->r4->u2->r2->d2->rl rl->d2->r7 r1->d2 Sample Output true false false Identify and implement relevant functions of each class as well as proper relationships among them

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions