Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am very confused about what to do after finding the positions of all of these characters. (Please write in MatLab code) This is what

image text in transcribed

image text in transcribed

I am very confused about what to do after finding the positions of all of these characters. (Please write in MatLab code)

This is what I have so far:

[dRow,dCol] = find(map == 'v'); [upRow,upCol] = find(map == '^'); [rRow,rCol] = find(map == '>'); [lRow,lCol] = find(map == '

if map1(1,1)=='v' right1 = rRow(rCol == 1) for v = (1:1:right1) map1(x,1) = '#' x = x+1; end end

Function Name: holyCannoli Inputs: 1. (char) MxN map of cannoli strewn around your city Outputs: 1. (char) MxN pathed map 2. (char) a string describing your cannoli condition Topics: (iteration: pathing). (conditionals). (arrays) Background: You absolutely LOVE cannoli. Can't get enough. In fact, you love them so much you're gonna drive around town with your cannoliTracker9000TM to hunt down all the cannoli in the city and eat them. Better start now before the cannoli cravings get too strong! Function Description: You are given an array that contains a map of the cannoli around your city. Write a function that paths around the array, eats cannoli, and leaves a trail of where you've been There are a few special tiles (characters) on the map to keep in mind: '', '', and 'v' indicate a direction change (direction-changing tiles) O">' directs you right ' of them :( If you reached the stopping position, output: 'I ate cannoli, and missed along the way! Example: map = ['v..c.>'; "..c..c.'; ">.cc.^.'; "..c...c'; 'c.f.c.s'] >> [pathedMap, cannoliDesc] = holyCannoli (map) mapFinal ['#..c. ##'; "#. outstr - 'I ate 5 cannoli, and missed 4 along the way!' Notes: You should replace the character at every location you path over, including the initial and final positions, any 'c', any '#', and any'.'. Paths are not guaranteed to be a set length across test cases. You might cross over previously travelled paths, but you will not be told to go out of bounds of the array. Eating over 30 cannoli and reaching the 'f' cannot occur simultaneously. The only characters present on the board at any time are >, ,

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Outline demographic considerations.

Answered: 1 week ago

Question

What is topology? Explain with examples

Answered: 1 week ago