Cody

Solution 2068622

Submitted on 24 Dec 2019 by Asif Newaz
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
k = 'Nd5'; p={'c3','c4','d3','e3','f4','f5','f6','g2','a5'} y_correct = [1 0 0 1 1 0 1 0 0]; assert(isequal(knight_move(k,p),y_correct))

p = 1×9 cell array {'c3'} {'c4'} {'d3'} {'e3'} {'f4'} {'f5'} {'f6'} {'g2'} {'a5'} a = 9 b = 'c3' b = 'c4' b = 'd3' b = 'e3' b = 'f4' b = 'f5' b = 'f6' b = 'g2' b = 'a5'

2   Pass
k = 'Ne3'; p={'c3','c4','d3','f4','f5','f6','g2','a5'} y_correct = [0 1 0 0 1 0 1 0]; assert(isequal(knight_move(k,p),y_correct))

p = 1×8 cell array {'c3'} {'c4'} {'d3'} {'f4'} {'f5'} {'f6'} {'g2'} {'a5'} a = 8 b = 'c3' b = 'c4' b = 'd3' b = 'f4' b = 'f5' b = 'f6' b = 'g2' b = 'a5'

3   Pass
k = 'Na8'; p={'c3','a7','a6','b6','c6','b2','f6'} y_correct = [ 0 0 0 1 0 0 0]; assert(isequal(knight_move(k,p),y_correct))

p = 1×7 cell array {'c3'} {'a7'} {'a6'} {'b6'} {'c6'} {'b2'} {'f6'} a = 7 b = 'c3' b = 'a7' b = 'a6' b = 'b6' b = 'c6' b = 'b2' b = 'f6'

Suggested Problems

More from this Author145