Cody

# Problem 44766. Lights Out 12 - 5x5, three stages, <7 moves

Solution 2486861

Submitted on 6 Jun 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   Fail
board = [1 1 0 0 0 1 0 0 0 0 0 0 0 2 0 0 0 2 2 2 0 0 0 2 0]; moves = lights_out_12(board); % [1 1 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test1 (line 6) moves = lights_out_12(board); % [1 1 19]

2   Fail
board = [2 2 0 2 2 2 0 2 0 2 0 2 2 2 0 2 0 2 0 2 2 2 0 2 2]; moves = lights_out_12(board); % [1 5 13 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test2 (line 6) moves = lights_out_12(board); % [1 5 13 21 25]

3   Fail
board = [0 1 0 0 0 1 1 1 0 1 0 1 0 1 1 1 0 0 0 1 1 1 0 0 0]; moves = lights_out_12(board); % [5 5 7 7 23 23] 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test3 (line 6) moves = lights_out_12(board); % [5 5 7 7 23 23]

4   Fail
board = [2 1 2 0 0 2 0 2 0 0 2 0 2 0 0 2 0 2 0 0 2 1 2 0 0]; moves = lights_out_12(board); % [6:10] 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test4 (line 6) moves = lights_out_12(board); % [6:10]

5   Fail
board = [1 1 0 0 0 2 0 0 0 0 1 1 0 0 0 2 0 0 0 0 1 1 0 0 0]; moves = lights_out_12(board); % [1 1 3 3 5 5] 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test5 (line 6) moves = lights_out_12(board); % [1 1 3 3 5 5]

6   Fail
board = [0 2 0 2 0 2 2 0 2 2 0 0 2 0 0 2 2 0 2 2 0 2 0 2 0]; moves = lights_out_12(board); % [7 9 13 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test6 (line 6) moves = lights_out_12(board); % [7 9 13 17 19]

7   Fail
board = [0 2 0 2 0 2 1 1 1 2 2 0 1 0 2 2 1 1 1 2 0 2 0 2 0]; moves = lights_out_12(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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test7 (line 6) moves = lights_out_12(board); % [7:9 17:19]

8   Fail
board = [0 0 0 0 0 0 2 1 2 0 2 0 2 0 2 0 2 1 2 0 0 0 0 0 0]; moves = lights_out_12(board); % [8 13 13 18] 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test8 (line 6) moves = lights_out_12(board); % [8 13 13 18]

9   Fail
board = [0 1 1 1 0 1 2 0 2 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0]; moves = lights_out_12(board); % [7 7 12 12 17 17] 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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test9 (line 6) moves = lights_out_12(board); % [7 7 12 12 17 17]

10   Fail
board = [0 0 0 1 2 0 0 2 2 1 0 1 0 2 2 0 1 1 2 2 2 0 0 0 2]; moves = lights_out_12(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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test10 (line 6) moves = lights_out_12(board); % on your own

11   Fail
board = [0 2 1 0 0 2 2 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; moves = lights_out_12(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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test11 (line 6) moves = lights_out_12(board);

12   Fail
board = [1 1 1 0 0 0 0 0 0 0 2 1 1 0 0 2 0 0 2 0 0 1 1 2 0]; moves = lights_out_12(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]),3); %remove semicolon to display progress end assert(sum(abs(board(:)))==0)

Unable to resolve the name freepass.please. Error in lights_out_12 (line 2) freepass.please; Error in Test12 (line 6) moves = lights_out_12(board);