Cody

# Problem 45240. Can the knight take out the pawn?

Solution 2815876

Submitted on 10 Aug 2020 by Rafael S.T. Vieira
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'} 3 3 3 4 4 3 5 3 6 4 6 5 6 6 7 2 1 5

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

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'} 3 3 1 7 1 6 2 6 3 6 2 2 6 6