Cody

Problem 294. A stroll on the beach: finding a route round a connected region

Solution 1291967

Submitted on 17 Oct 2017
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
b = [0 0 0 0 0 1 2 0 0 0 0 0]; route_correct = 'WE'; assert(isequal(circumNavigate(b),route_correct))

Undefined function 'direction' for input arguments of type 'double'. Error in circumNavigate (line 35) route=[route direction(nextPos(5,1))]; Error in Test1 (line 5) assert(isequal(circumNavigate(b),route_correct))

2   Fail
b = [0 0 0 0 0 0 0 0 2 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0]; route_correct = 'SEEWWSNWEN'; assert(isequal(circumNavigate(b),route_correct))

Undefined function 'direction' for input arguments of type 'double'. Error in circumNavigate (line 35) route=[route direction(nextPos(5,1))]; Error in Test2 (line 7) assert(isequal(circumNavigate(b),route_correct))

3   Fail
b = [0 0 0 0 0 0 0 0 1 2 0 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]; route_correct = 'SEENESWWSNWWNE'; assert(isequal(circumNavigate(b),route_correct))

Undefined function 'direction' for input arguments of type 'double'. Error in circumNavigate (line 35) route=[route direction(nextPos(5,1))]; Error in Test3 (line 7) assert(isequal(circumNavigate(b),route_correct))

4   Fail
b = [0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0]; route_correct = 'WNNEEESEWWSW'; assert(isequal(circumNavigate(b),route_correct))

Undefined function 'direction' for input arguments of type 'double'. Error in circumNavigate (line 35) route=[route direction(nextPos(5,1))]; Error in Test4 (line 7) assert(isequal(circumNavigate(b),route_correct))

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!