Cody

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

Solution 3057187

Submitted on 4 Oct 2020 by Nikolaos Nikolaou
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'} y = 1 0 0 1 1 0 1 0 0

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'} y = 0 1 0 0 1 0 1 0

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'} y = 0 0 0 1 0 0 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!