Cody

Solution 2069249

Submitted on 26 Dec 2019 by Binbin Qi
  • Size: 26
  • 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
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'}

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'}

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'}

Suggested Problems

More from this Author65