Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Function Name: XMarksTheSpot Inputs: 1. (char) An NxM character array representing a map 2. (char) A 1xN character vector representing a series of directions Outputs:
Function Name: XMarksTheSpot Inputs: 1. (char) An NxM character array representing a map 2. (char) A 1xN character vector representing a series of directions Outputs: 1. (char) A string representing the result and the path you take Background: You and your friends stumble upon an ancient treasure map one day and decide to embark on an adventure. Even though you tell them you'll meet up tomorrow to look for it together, you grow suspicious that they are trying to claim the treasure for themselves! As a CS 1371 student, you decide to use your MATLAB skills to try to find it before your friends do! Function Description: Write a function that navigates through a character array map based on given directions Starting at the top left corner, move according to the following directions Direction Movement 'S Down Right Left W' After each direction, make sure to record your current location (the value of the character in the map). Keep going through the directions until you reach the treasure, represented by an 'X', or reach the end of the directions If you encounter the 'X", your final output should be in the form I found the treasure by following the path along ! If you go through all the given directions and don't find the treasure, output: I went along the path but couldn't find the treasure
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started