Question: Help me figure out this Matlab problem! Function Name: seaLiners Inputs: 1. 2. (char) an MxN map representing the ships at sea. (char) an MxN

Help me figure out this Matlab problem!
 Help me figure out this Matlab problem! Function Name: seaLiners Inputs:
1. 2. (char) an MxN map representing the ships at sea. (char)

Function Name: seaLiners Inputs: 1. 2. (char) an MxN map representing the ships at sea. (char) an MxN map representing the routes on the sea. Outputs 1. (double) a 1x2 vector showing where the first crash occurred. 2. (double) time before the crash occurred. Background: You have been contacted by a marine shipping company. Unfortunately, being former pirates, they have no idea how to set up an actual legitimate business. Their ships keep crashing into each other! You have been tasked to figure out where and when the next collision will occur Function Description You will be given two character arrays of the same size, one will contain a number of ships. Ships will move around the character array based on which way they are facing and the route they are on. Routes are given in the other array. The route consists of and for straight paths, ' \' and "/ ' for curves, and .+' for intersections. There are ships on these routes. Ships always face a direction, for up,for right, v' for down, and for left. Any ime the ships hit a .\" or a. it will turn as you would expect a ship to tum (e.g. a .^. that moves into a '/ will turn right). At an intersection, ships will always continue straight through. All ships move at the same speed, ships take turns moving and all ships move during one tick. The one in the most top left goes first, followed by those to its right, then the ones in the next row. It iterates along the rows and then down the columns. Each ship moves one space on its turn moving along the route. Your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred. Example 1 routesships- Progresses as shown belovw Iteration 1: ->- Iteration 2: (continued.. Iteration 3: x- (done) collision -[1, 4] time 3 Example 2: routes =--| " ships shown as ./---->\ Progresses as shown below: Iteration 1: 'I -(ship continues straight) Iteration 2: x(done) collision - [2, me -2 Notes . You do not have to combine the two arrays in your function. It may be easier to not combine them. . You are given a function that will generate test cases for you type 'help seaLinerGen to learn more. . There will be no three-way intersections

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!