Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COULD YOU WRTE T'S CODE WTH R PROGRAMNG The coding in these files is quite simple. Walls are marked with an x. You cannot cross

COULD YOU WRTE T'S CODE WTH R PROGRAMNG

image text in transcribedThe coding in these files is quite simple. Walls are marked with an "x". You cannot cross these walls. The starting point is marked with an "s" and the exit point is marked with an "e". There is nothing else in these files. You can create your own files like that. Try it!

Reading mazes in

The first function you need to write is a function for reading in mazes from files. The function must be named readMap(). It should take a single argument named path. The argument should hold a path to a file to be read. The read map can be stored in any data structure. This is left for you to decide.

Finding a path through a maze

The second function you need to write is a function for finding a path through a labyrinth. The function must be named findWay(). It should accept one argument called map for a map. The task of this function is to find a path from the starting point to the exit point. The path cannot cross walls. It is not required to find the optimal (shortest) path. Also, it is assumed that there is such a path; you do not need to test for it. The found path can be stored in any appropriate data structure. This choice is left to you.

Visualization

You need to write two functions. The first is for plotting a map, and the other is for plotting a path over a maze. The function plotting a map must be named plotMap(). It should take a single argument m for a map. It may take some additional graphical arguments. The second function, for over-plotting a path, must be named ~plotPath(). This function should accept argument m for a path. Also, this function may accept some additional graphical arguments. In the following examples, I proposed some visualizations but you do not have to match them exactly.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

User Defined Tensor Data Analysis

Authors: Bin Dong ,Kesheng Wu ,Suren Byna

1st Edition

3030707490, 978-3030707491

More Books

Students also viewed these Databases questions

Question

Explain basic guidelines for effective multicultural communication.

Answered: 1 week ago

Question

Identify communication barriers and describe ways to remove them.

Answered: 1 week ago

Question

Explain the communication process.

Answered: 1 week ago