Cody

# Problem 45329. Castling-01

Solution 2171059

Submitted on 23 Mar 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
a={'Ra1','Ka7'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Ra1'} {'Ka7'} S1 = 0 0 0 0 0 0 0 0 0 S2 = 1 0 0 0 0 0 0 0 0

2   Pass
a={'Ra1','Rh1'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Ra1'} {'Rh1'} S1 = 0 0 0 0 0 0 0 0 0 S2 = 1 0 0 0 0 0 0 1 0

3   Pass
a={'Ra1','Rh1','Kh8'} assert(isequal(castling_01(a),0))

a = 1×3 cell array {'Ra1'} {'Rh1'} {'Kh8'} S1 = 0 0 0 0 0 0 0 1 0 S2 = 1 0 0 0 0 0 0 1 0

4   Pass
a={'Ra1','Rc1','Kh5'} assert(isequal(castling_01(a),0))

a = 1×3 cell array {'Ra1'} {'Rc1'} {'Kh5'} S1 = 0 0 0 0 0 0 0 0 0 S2 = 1 0 1 0 0 0 0 0 0

5   Pass
a={'Ra1','Rh1','Ke1'} assert(isequal(castling_01(a),1))

a = 1×3 cell array {'Ra1'} {'Rh1'} {'Ke1'} y = 1 S1 = 0 0 0 0 0 0 0 0 0 S2 = 1 0 0 0 1 0 0 1 0

6   Pass
a={'Ra1','Rh1','Ke1'} assert(isequal(castling_01(a),1))

a = 1×3 cell array {'Ra1'} {'Rh1'} {'Ke1'} y = 1 S1 = 0 0 0 0 0 0 0 0 0 S2 = 1 0 0 0 1 0 0 1 0

7   Pass
a={'Rh1','Ke1'} assert(isequal(castling_01(a),1))

a = 1×2 cell array {'Rh1'} {'Ke1'} y = 1 S1 = 0 0 0 0 0 0 0 0 0 S2 = 0 0 0 0 1 0 0 1 0

8   Pass
a={'Rh5','Ke5'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Rh5'} {'Ke5'} S1 = 0 0 0 0 0 0 0 0 0 S2 = 0 0 0 0 0 0 0 0 0

9   Pass
a={'Ra8','Ke8'} assert(isequal(castling_01(a),1))

a = 1×2 cell array {'Ra8'} {'Ke8'} y = 1 S1 = 1 0 0 0 1 0 0 0 0 S2 = 0 0 0 0 0 0 0 0 0

10   Pass
a={'Rd8','Rh8','Ke8'} assert(isequal(castling_01(a),1))

a = 1×3 cell array {'Rd8'} {'Rh8'} {'Ke8'} y = 1 S1 = 0 0 0 1 1 0 0 1 0 S2 = 0 0 0 0 0 0 0 0 0

11   Pass
a={'Rh8','Kd8'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Rh8'} {'Kd8'} S1 = 0 0 0 1 0 0 0 1 0 S2 = 0 0 0 0 0 0 0 0 0