Cody

Solution 435817

Submitted on 28 Apr 2014 by Joel
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 = [ 0 0 ; 6 -8 ]; F = [ -4 4 4 -4 2 2 -4 -4 ]; n = WayfindingBoundaryCrossing(AB,F); n_correct = 2; assert(isequal(n,n_correct));

ii = 2 ii = 3 ii = 4 NewMatrixF(:,:,1) = -4 4 2 2 NewMatrixF(:,:,2) = 4 4 2 -4 NewMatrixF(:,:,3) = 4 -4 -4 -4 NewMatrixF(:,:,4) = -4 -4 -4 2 Node = -4 2 xpos = 0 tf = 1 n = 1 n = 1 Node = 4 2 xpos = 0 n = 1 Node = 4 -4 xpos = 0 tf = 1 n = 2 n = 2 Node = -4 -4 xpos = 0 n = 2

2   Pass
%% AB = [ 0 0 ; 4 -6 ]; F = [ -6 4 0 -0 2 -4 ]; n = WayfindingBoundaryCrossing(AB,F); n_correct = 2; assert(isequal(n,n_correct));

ii = 2 ii = 3 NewMatrixF(:,:,1) = -6 4 0 2 NewMatrixF(:,:,2) = 4 0 2 -4 NewMatrixF(:,:,3) = 0 -6 -4 0 Node = -6 0 xpos = 0 tf = 1 n = 1 n = 1 Node = 4 2 xpos = 0 tf = 1 n = 2 n = 2 Node = 0 -4 xpos = 0 tf = 1 n = 3 n = 2 n = 2

3   Pass
%% AB = [ 6 -6 ; 0 0 ]; F = [ -8 -8 4 2 -4 -0 ]; n = WayfindingBoundaryCrossing(AB,F); n_correct = 1; assert(isequal(n,n_correct));

ii = 2 ii = 3 NewMatrixF(:,:,1) = -8 -8 2 -4 NewMatrixF(:,:,2) = -8 4 -4 0 NewMatrixF(:,:,3) = 4 -8 0 2 Node = -8 2 n = 0 Node = -8 -4 xposeq = 4.0000 xposeq = 4 yposeq = 0 yposeq = 0 tf = 1 n = 1 Pointofint = 4 0 Pointofint = 4 0 n = 1 Node = 4 0 xposeq = 4 xposeq = 4 yposeq = 0 yposeq = 0 tf = 1 n = 2 Pointofint = 4 0 Pointofint = 4 0 n = 1

4   Pass
%% AB = [ 8 -6 ; 6 -8 ]; F = [ -6 0 -3 7 9 4 6 -4 -7 -2 -7 -8 -9 -9 0 -4 1 7 -0 4 -1 -7 -5 -9 ]; n = WayfindingBoundaryCrossing(AB,F); n_correct = 7; assert(isequal(n,n_correct));

ii = 2 ii = 3 ii = 4 ii = 5 ii = 6 ii = 7 ii = 8 ii = 9 ii = 10 ii = 11 ii = 12 NewMatrixF(:,:,1) = -6 0 -9 -9 NewMatrixF(:,:,2) = 0 -3 -9 0 NewMatrixF(:,:,3) = -3 7 0 -4 NewMatrixF(:,:,4) = 7 9 -4 1 NewMatrixF(:,:,5) = 9 4 1 7 NewMatrixF(:,:,6) = 4 6 7 0 NewMatrixF(:,:,7) = 6 -4 0 4 NewMatrixF(:,:,8) = -4 -7 4 -1 NewMatrixF(:,:,9) = -7 -2 -1 -7 NewMatrixF(:,:,10) = -2 -7 -7 -5 NewMatrixF(:,:,11) = -7 -8 -5 -9 NewMatrixF(:,:,12) = -8 -6 -9 -9 Node = -6 -9 xposeq = -7 xposeq = -7 yposeq = -9 yposeq = -9 Pointofint = -7 -9 Pointofint = -7 -9 n = 0 Node = 0 -9 xposeq = -1.7500 xposeq = -2 yposeq = -4 yposeq = -4 tf = 1 n = 1 Pointofint = -2 -4 Pointofint = -2 -4 n = 1 Node = -3 0 xposeq = 0.5714 xposeq = 1 xposeq = 1 yposeq = -1 yposeq = -1 tf = 1 n = 2 Pointofint = 1 -1 Pointofint = 1 -1 n = 2 Node = 7 -4 xposeq = 13 xposeq = 13 yposeq = 11 yposeq = 11 Pointofint = 13 11 Pointofint = 13 11 n = 2 Node = 9 1 xposeq = 6.2727 xposeq = 6 yposeq = 4 yposeq = 4 tf = 1 n = 3 Pointofint = 6 4 Pointofint = 6 4 n = 3 Node = 4 7 xposeq = 5.1111 xposeq = 5 yposeq = 3 yposeq = 3 tf = 1 n = 4 Pointofint = 5 3 Pointofint = 5 3 n = 4 Node = 6 0 xposeq = 3.1429 xposeq = 3 yposeq = 1 yposeq = 1 tf = 1 n = 5 Pointofint = 3 1 Pointofint = 3 1 n = 5 Node = -4 4 xposeq = -19 xposeq = -19 yposeq = -21 yposeq = -21 Pointofint = -19 -21 Pointofint = -19 -21 n = 5 Node = -7 -1 xposeq = -3.3636 xposeq = -3 xposeq = -3 yposeq = -5 yposeq = -5 tf = 1 n = 6 Pointofint = -3 -5 Pointofint = -3 -5 n = 6 Node = -2 -7 xposeq = -4.1429 xposeq = -4 xposeq = -4 yposeq = -6 yposeq = -6 tf = 1 n = 7 Pointofint = -4 -6 Pointofint = -4 -6 n = 7 Node = -7 -5 xposeq = -8.3333 xposeq = -8 xposeq = -8 yposeq = -10 yposeq = -10 Pointofint = -8 -10 Pointofint = -8 -10 n = 7 Node = -8 -9 xposeq = -7 xposeq = -7 yposeq = -9 yposeq = -9 Pointofint = -7 -9 Pointofint = -7 -9 n = 7

5   Pass
%% n_correct = randi(9)-1; AB = [ 0 0 ; n_correct*2-9 -10 ]; F = [ -2 -2 2 2 -2 -2 2 2 -2 -2 2 2 -2 -2 4 4 -8 -6 -6 -4 -4 -2 -2 -0 -0 2 2 4 4 6 6 -8 ]; n = WayfindingBoundaryCrossing(AB,F); assert(isequal(n,n_correct));

ii = 2 ii = 3 ii = 4 ii = 5 ii = 6 ii = 7 ii = 8 ii = 9 ii = 10 ii = 11 ii = 12 ii = 13 ii = 14 ii = 15 ii = 16 NewMatrixF(:,:,1) = -2 -2 -8 -6 NewMatrixF(:,:,2) = -2 2 -6 -6 NewMatrixF(:,:,3) = 2 2 -6 -4 NewMatrixF(:,:,4) = 2 -2 -4 -4 NewMatrixF(:,:,5) = -2 -2 -4 -2 NewMatrixF(:,:,6) = -2 2 -2 -2 NewMatrixF(:,:,7) = 2 2 -2 0 NewMatrixF(:,:,8) = 2 -2 0 0 NewMatrixF(:,:,9) = -2 -2 0 2 NewMatrixF(:,:,10) = -2 2 2 2 NewMatrixF(:,:,11) = 2 2 2 4 NewMatrixF(:,:,12) = 2 -2 4 4 NewMatrixF(:,:,13) = -2 -2 4 6 NewMatrixF(:,:,14) = -2 4 6 6 NewMatrixF(:,:,15) = 4 4 6 -8 NewMatrixF(:,:,16) = 4 -2 -8 -8 Node = -2 -8 xpos = 0 n = 0 Node = -2 -6 xpos = 0 tf = 1 n = 1 n = 1 Node = 2 -6 xpos = 0 n = 1 Node = 2 -4 xpos = 0 tf = 1 n = 2 n = 2 Node = -2 -4 xpos = 0 n = 2 Node = -2 -2 xpos = 0 tf = 1 n = 3 n = 3 Node = 2 -2 xpos = 0 n = 3 Node = 2 0 xpos = 0 tf = 1 n = 4 n = 4 Node = -2 0 xpos = 0 n = 4 Node = -2 2 xpos = 0 tf = 1 n = 5 n = 5 Node = 2 2 xpos = 0 n = 5 Node = 2 4 xpos = 0 tf = 1 n = 6 n = 6 Node = -2 4 xpos = 0 n = 6 Node = -2 6 xpos = 0 n = 6 Node = 4 6 xpos = 0 n = 6 Node = 4 -8 xpos = 0 tf = 1 n = 7 n = 7