Cody

# Problem 306. Eight Queens Solution Checker

Solution 1728536

Submitted on 16 Feb 2019 by Abdelfatah Teamah
• Size: 7
• This is the leading solution.
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
% 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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint1 (line 12) In solutionTest (line 3)]

2   Pass
% 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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint2 (line 11) In solutionTest (line 5)]

3   Pass
% 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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint3 (line 11) In solutionTest (line 7)]

4   Pass
% 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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint4 (line 11) In solutionTest (line 9)]

5   Pass
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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint5 (line 10) In solutionTest (line 11)]

6   Pass
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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint6 (line 10) In solutionTest (line 13)]

7   Pass
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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint7 (line 10) In solutionTest (line 15)]

8   Pass
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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint8 (line 10) In solutionTest (line 17)]

9   Pass
% 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));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint9 (line 11) In solutionTest (line 19)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isEightQueensSolution (line 2) In ScoringEngineTestPoint10 (line 4) In solutionTest (line 21)]