Cody

# Problem 45329. Castling-01

Solution 2171051

Submitted on 23 Mar 2020
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'} y = 0

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

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

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

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

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

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

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

a = 1×3 cell array {'Ra1'} {'Rh1'} {'Ke1'} y = 5

Assertion failed.

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

a = 1×3 cell array {'Ra1'} {'Rh1'} {'Ke1'} y = 5

Assertion failed.

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

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

Assertion failed.

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

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

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

a = 1×2 cell array {'Ra8'} {'Ke8'} y = 5

Assertion failed.

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

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

Assertion failed.

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

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