Cody

Solution 2195516

Submitted on 6 Apr 2020 by James
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   Pass
y_correct = [3 2 2 2 3 4; 3 2 1 2 3 4; ... 3 2 2 2 3 4; 3 3 3 3 3 4; 4 4 4 4 4 4; ... 5 5 5 5 5 5]; assert(isequal(safety_map(6,2,3),y_correct))

z = 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 z = 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 z = 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 4 4 4 4 4 3 2 1 1 2 3 4 4 4 4 4 3 2 1 1 2 3 4 4 4 4 4 3 2 1 1 2 3 4 4 4 4 4 3 2 1 1 2 3 4 4 4 4 4 3 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 z = 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 1 1 2 3 3 3 3 3 3 3 2 1 1 2 3 4 4 4 4 4 3 2 1 1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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 1 2 3 4 4 4 4 4 4 4 4 4 4 4 4 4 3 2 1 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 ...

4   Pass
y_correct = 1; assert(isequal(safety_map(1,1,1),y_correct))

z = 1 a = 1 b = 1 xStart = 1 xEnd = 1 yStart = 1 yEnd = 1 z = 1

5   Pass
y_correct = [4 3 2 2; ... 4 3 2 1; 4 3 2 2; 4 3 3 3]; assert(isequal(safety_map(4,2,4),y_correct))

z = 1 1 1 1 1 1 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 1 1 1 1 1 1 z = 1 1 1 1 1 1 1 1 2 2 2 2 2 1 1 2 3 3 3 2 1 1 2 3 3 3 2 1 1 2 3 3 3 2 1 1 2 2 2 2 2 1 1 1 1 1 1 1 1 z = 1 1 1 1 1 1 1 1 2 2 2 2 2 1 1 2 3 3 3 2 1 1 2 3 4 3 2 1 1 2 3 3 3 2 1 1 2 2 2 2 2 1 1 1 1 1 1 1 1 z = 4 4 4 4 4 4 4 4 3 3 3 3 3 4 4 3 2 2 2 3 4 4 3 2 1 2 3 4 4 3 2 2 2 3 4 4 3 3 3 3 3 4 4 4 4 4 4 4 4 a = 4 b = 4 xStart = 3 xEnd = 6 yStart = 1 yEnd = 4 z = 4 3 2 2 4 3 2 1 4 3 2 2 4 3 3 3

6   Pass
y_correct = [2 1;2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 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 6 6 5 4 3 2 1 1 2 3 4 5 6 6 6 6 6 6 6 ...

9   Pass
y_correct = [3 3 3; 2 2 3; 1 2 3]; assert(isequal(safety_map(3,3,1),y_correct))

z = 1 1 1 1 1 1 2 2 2 1 1 2 2 2 1 1 2 2 2 1 1 1 1 1 1 z = 1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1 z = 3 3 3 3 3 3 2 2 2 3 3 2 1 2 3 3 2 2 2 3 3 3 3 3 3 a = 3 b = 3 xStart = 1 xEnd = 3 yStart = 3 yEnd = 5 z = 3 3 3 2 2 3 1 2 3

10   Pass
y_correct = [2 1 2; 2 2 2; 3 3 3]; assert(isequal(safety_map(3,1,2),y_correct))

z = 1 1 1 1 1 1 2 2 2 1 1 2 2 2 1 1 2 2 2 1 1 1 1 1 1 z = 1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1 z = 3 3 3 3 3 3 2 2 2 3 3 2 1 2 3 3 2 2 2 3 3 3 3 3 3 a = 3 b = 3 xStart = 3 xEnd = 5 yStart = 2 yEnd = 4 z = 2 1 2 2 2 2 3 3 3