Cody

Solution 1697363

Submitted on 20 Dec 2018
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   Fail
board = [0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0]; moves = lights_out_7(board); % [13] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test1 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

2   Fail
board = [0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0]; moves = lights_out_7(board); % [7 13 19] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test2 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

3   Fail
board = [0 1 1 1 0 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 0 1 1 1 0]; moves = lights_out_7(board); % [7:9 12:14 17:19] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test3 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

4   Fail
board = [0 1 0 1 0 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0]; moves = lights_out_7(board); % [7 9 17 19] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test4 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

5   Fail
board = [1 0 0 0 1 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 0 1]; moves = lights_out_7(board); % [1 5 7 9 13 17 19 21 25] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test5 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

6   Fail
board = [0 0 0 0 0 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 0 0 0 0 0]; moves = lights_out_7(board); % [1:5 11:15 21:25] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test6 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

7   Fail
board = [0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0]; moves = lights_out_7(board); % [7 8 9 17 18 19] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test7 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

8   Fail
board = [0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 1 1]; moves = lights_out_7(board); % [18:25] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test8 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

9   Fail
board = [1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1]; moves = lights_out_7(board); % [1:6 10:11 15:16 20:25] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test9 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

10   Fail
board = [1 1 0 1 1 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1]; moves = lights_out_7(board); % [1:2 4:7 9:10 16:17 19:22 24:25] b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test10 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

11   Fail
board = [1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0]; moves = lights_out_7(board); % on your own b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test11 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

12   Fail
board = [0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0]; moves = lights_out_7(board); b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test12 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

13   Fail
board = [1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1]; moves = lights_out_7(board); b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test13 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

14   Fail
board = [0 0 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0 1]; moves = lights_out_7(board); b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test14 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

15   Fail
board = [1 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 0]; moves = lights_out_7(board); b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test15 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

16   Fail
board = [1 1 1 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 1 1 1 1]; moves = lights_out_7(board); b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test16 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

17   Fail
board = [1 1 1 0 0 0 0 1 0 1 1 0 1 0 1 0 1 1 0 0 0 1 0 0 1]; moves = lights_out_7(board); b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test17 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress

18   Fail
board = [0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 1]; moves = lights_out_7(board); b1 = diag(ones(1,5),0) + diag(ones(1,4),1) + diag(ones(1,4),-1); b2 = eye(5); b3 = zeros(5); b_map = [b1,b2,b3,b3,b3;b2,b1,b2,b3,b3;b3,b2,b1,b2,b3;b3,b3,b2,b1,b2;b3,b3,b3,b2,b1]; for i = 1:numel(moves) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in Test18 (line 10) board = mod(board + reshape(b_map(moves(i),:),[5,5]),2); %remove semicolon to display progress