Cody

Problem 306. Eight Queens Solution Checker

Solution 2829096

Submitted on 13 Aug 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
% Unique solution #6 from % http://en.wikipedia.org/wiki/Eight_queens_puzzle in1 = [ ... 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 ]; out1 = isEightQueensSolution(in1); assert(islogical(out1)); assert(isequal(out1, 1));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

2   Fail
% Unique solution #7 in2 = [ ... 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 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 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 ]; out2 = isEightQueensSolution(in2); assert(isequal(out2, 1));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

3   Fail
% Unique solution #10 in3 = [ ... 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ]; out3 = isEightQueensSolution(in3); assert(isequal(out3, 1));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

4   Fail
% Unique solution #11 in4 = [ ... 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 ]; out4 = isEightQueensSolution(in4); assert(isequal(out4, 1));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

5   Fail
in5 = [ ... 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 ]; out5 = isEightQueensSolution(in5); assert(isequal(out5, 0));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

6   Fail
in6 = [ ... 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 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 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 ]; out6 = isEightQueensSolution(in6); assert(isequal(out6, 0));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

7   Fail
in7 = [ ... 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 ]; out7 = isEightQueensSolution(in7); assert(isequal(out7, 0));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

8   Fail
in8 = [ ... 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 ]; out8 = isEightQueensSolution(in8); assert(isequal(out8, 0));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

9   Fail
% Only 7 queens in9 = [ ... 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 ]; out9 = isEightQueensSolution(in9); assert(isequal(out9, 0));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.

10   Fail
% Row and column constraint satisfied but % not diagonal constraint. in10 = eye(8); out10 = isEightQueensSolution(in10); assert(isequal(out10, 0));

Error in solution: Line: 46 Column: 1 The function "queens" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.