Cody

Solution 2115608

Submitted on 3 Feb 2020 by Asif Newaz
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
board=[1 0 0 1; 0 0 0 1; 0 0 1 0]; y_correct=6; assert(isequal(taking_liberties(board),y_correct))

x = 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0

2   Pass
board=eye(7); y_correct=12; assert(isequal(taking_liberties(board),y_correct))

x = 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0

3   Pass
board=double(magic(4)>12); y_correct=8; assert(isequal(taking_liberties(board),y_correct))

x = 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0

4   Pass
board=double(hadamard(8)<0); y_correct=29; assert(isequal(taking_liberties(board),y_correct))

x = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0

5   Pass
board=ones(4); y_correct=0; assert(isequal(taking_liberties(board),y_correct))

x = 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0

6   Pass
board=vertcat(eye(5),[1 0 1 0 1]); y_correct=12; assert(isequal(taking_liberties(board),y_correct))

x = 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0