Cody

# Problem 2226. Wayfinding 4 - Crossing, level 2

Solution 1669316

Submitted on 8 Nov 2018 by Oleksandr Denysenko
• Size: 34
• This is the leading solution.
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
AB = [ -10 10 ; -10 10 ]; F{1} = [ -5 5 -8 0 -6 2 7 1 ]; F{2} = [ 4 -2 4 6 6 -7 -3 -2 ]; F{3} = [ -5 6 3 -1 -6 -8 4 -2 ]; f = WayfindingPassed(AB,F); f_correct = [ 1 3 2 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In WayfindingPassed (line 5) In ScoringEngineTestPoint1 (line 14) In solutionTest (line 3)]

2   Pass
AB = [ 0 21 ; 0 0 ]; f_correct = randperm(20); F = arrayfun(@(n)[n+[0 1 1 0];-1 -1 1 1],f_correct,'uni',0); f = WayfindingPassed(AB,F); assert(isequal(f(f_correct),f_correct(f)));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

3   Pass
AB = [ -10 10 ; -10 10 ]; F{1} = [ -5 9 0 -4 5 2 8 -1 -9 -8 ]; F{2} = [ -2 -10 -4 0 8 7 -5 5 ]; F{3} = [ -6 2 10 10 -4 8 ]; F{4} = [ -10 8 -10 4 -8 2 ]; F{5} = [ 0 4 8 -3 1 -10 9 -8 -5 2 ]; F{6} = [ 6 6 -9 10 6 -3 4 -7 ]; F{7} = [ 9 7 -7 0 7 -5 ]; F{8} = [ 2 0 10 6 -10 0 ]; F{9} = [ -7 2 -7 -7 3 5 -3 7 ]; F{10} = [ -5 6 1 5 -10 0 8 4 ]; f = WayfindingPassed(AB,F); f_correct = [ 2 7 8 10 7 3 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint3 (line 42) In solutionTest (line 7)]

4   Pass
AB = [ -10 10 ; -10 10 ]; F{1} = [ 2 5 8 5 2 -2 9 -5 ]; F{2} = [ -8 2 -2 8 -8 -2 0 4 5 -9 8 -2 ]; F{3} = [ 5 -6 -2 1 0 10 10 -8 0 10 -2 -5 ]; F{4} = [ 10 -4 -10 -2 9 4 1 8 -4 -1 ]; F{5} = [ -9 -7 2 -3 2 -9 -4 5 ]; F{6} = [ -3 10 6 9 4 -2 10 -6 2 2 5 -5 ]; F{7} = [ -1 -5 -5 3 0 -4 ]; F{8} = [ 8 -6 8 10 -7 8 -2 -5 3 7 ]; F{9} = [ 1 -10 -3 10 5 -5 -6 3 -6 8 ]; F{10} = [ -7 0 8 -8 7 -8 3 9 ]; f = WayfindingPassed(AB,F); f_correct = [ 5 9 10 9 3 1 8 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint4 (line 42) In solutionTest (line 9)]

5   Pass
AB = [ 4 -6 ; 0 0 ]; F{1} = [ -4 -4 2 2 -2 -3 -3 -2 2 2 -4 2 -4 -4 -2 2 2 -2 -2 2 4 4 ]; f = WayfindingPassed(AB,F); f_correct = [ 1 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint5 (line 6) In solutionTest (line 11)]

6   Pass
AB = [ 0 0 ; 15 -8 ]; F{1} = [ -4 4 4 -4 6 2 6 2 ]; F{2} = [ -2 -2 6 6 -2 -0 -4 -0 -4 -0 ]; F{3} = [ -1 -1 2 2 -6 -4 -6 -4 ]; F{4} = [ -1 1 -1 1 -7 -7 -9 -9 ]; F{5} = [ -2 2 -1 2 -1 1 14 10 6 6 10 14 ]; f = WayfindingPassed(AB,F); f_correct = [ 5 5 1 2 3 4 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint6 (line 22) In solutionTest (line 13)]

7   Pass
AB = [ 0 0 ; -6 6 ]; F{1} = [ -5 7 7 -5 -9 -9 9 9 ]; F{2} = [ -1 1 1 -1 -7 -7 -5 -5 ]; F{3} = [ -2 -2 2 2 4 2 2 4 ]; F{4} = [ 2 2 -2 -2 4 2 2 4 ]; F{5} = [ -1 1 1 -1 2 2 -2 -2 ]; F{6} = [ -2 0 -2 -2 -3 -4 ]; F{7} = [ 0 2 2 -3 -4 -2 ]; F{8} = [ -1 0 1 -8 -6 -8 ]; f = WayfindingPassed(AB,F); f_correct = [8 2 1 7 1 5 4 1]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint7 (line 34) In solutionTest (line 15)]

8   Pass
AB = [ 2 -2 ; 8 -6 ]; F{1} = [ -4 -4 4 4 -4 -0 -0 -4 ]; F{2} = [ -4 -4 4 4 2 6 6 2 ]; f = WayfindingPassed(AB,F); f_correct = [2 1]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint8 (line 10) In solutionTest (line 17)]

9   Pass
AB = [ 8 -4 ; 8 -8 ]; F{1} = [ -6 2 2 -4 -4 8 8 -6 -6 -6 -4 -4 2 2 4 4 ]; F{2} = [ -2 -2 4 4 -0 -2 -2 -0 ]; f = WayfindingPassed(AB,F); f_correct = [ 1 2 1 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint9 (line 10) In solutionTest (line 19)]

10   Pass
AB = [ -8 8 ; 8 -8 ]; F{1} = [ -2 -2 0 0 -0 2 2 -0 ]; F{2} = [ 2 4 4 -6 -6 -4 2 4 4 2 2 -4 -4 2 -0 -0 -6 -6 4 6 6 4 2 2 4 4 -4 -4 ]; F{3} = [ -3 -3 1 0 -1 -3 -3 -1 ]; F{4} = [ 5 9 9 5 -3 -3 -9 -9 ]; F{5} = [ -9 -10 -10 -9 9 9 10 10 ]; f = WayfindingPassed(AB,F); f_correct = [ 2 1 2 4 ]; assert(isequal(f,f_correct)); AB = [ 0 0 ; -8 8 ]; F{1} = [ -4 -2 -2 -4 8 8 4 4 ]; F{2} = [ 2 4 4 2 -0 -0 -6 -6 ]; F{3} = [ -4 -2 -2 -6 -6 -4 -4 -6 -6 -4 ]; f = WayfindingPassed(AB,F); assert(isempty(f));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint10 (line 22) In solutionTest (line 21)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint10 (line 39) In solutionTest (line 21)]

11   Pass
AB = [ 7 -8 ; 0 0 ]; F{1} = [ 8 9 9 8 3 3 -2 -2 ]; F{2} = [ -9 -7 -7 -4 -4 -3 -3 0 0 1 1 4 4 5 5 -2 -8 -9 -2 -2 2 2 -2 -2 2 2 -2 -2 2 2 -2 -2 3 4 3 2 ]; F{3} = [ -2 -1 -1 -2 1 1 -4 -4 ]; F{4} = [ -6 -5 -5 -3 1 2 2 3 3 1 -4 -6 1 1 -3 -5 -5 -4 1 1 -5 -8 -7 -4 ]; f = WayfindingPassed(AB,F); f_correct = [ 2 4 2 3 2 4 2 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint11 (line 18) In solutionTest (line 23)]

12   Pass
AB = [ 0 -2 ; 0 -4 ]; F{1} = [ -3 3 3 2 2 -2 -2 2 2 -3 -5 -5 3 3 -3 -3 2 2 3 3 ]; F{2} = [ -1 1 1 -1 1 1 -1 -1 ]; F{3} = [ -4 4 4 5 5 -5 -5 -4 4 4 -7 -7 5 5 -1 -1 ]; F{4} = [ -5 -4 -4 4 4 -5 -1 -1 -6 -6 -7 -7 ]; f = WayfindingPassed(AB,F); f_correct = [ 2 1 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint12 (line 18) In solutionTest (line 25)]

13   Pass
AB = [ -2 0 ; 6 -6 ]; F{1} = [ 2 -4 -4 2 2 -2 0 -2 2 -4 -4 4 4 2 2 -0 -2 -2 ]; f = WayfindingPassed(AB,F); f_correct = [ 1 1 1 ]; assert(isequal(f,f_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In WayfindingPassed (line 3) In ScoringEngineTestPoint13 (line 6) In solutionTest (line 27)]