Cody

Solution 1790958

Submitted on 16 Apr 2019 by Paul Smits
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
a = ... [ 7 2 5 4 0 8 1 6 3]; tf_correct = true; assert(isequal(knights_tour(a),tf_correct))

sm = 3 1 1 1 2 2 3 3 3 2 1 4 1 3 5 3 2 6 1 1 7 2 3 8 tf = logical 1

2   Pass
a = ... [ 1 0 0 0 0 2]; tf_correct = true; assert(isequal(knights_tour(a),tf_correct))

sm = 1 1 1 2 3 2 tf = logical 1

3   Pass
a = ... [ 15 5 12 3 0 2 9 6 8 11 4 13 1 14 7 10]; tf_correct = false; assert(isequal(knights_tour(a),tf_correct))

sm = 4 1 1 2 2 2 1 4 3 3 3 4 1 2 5 2 4 6 4 3 7 3 1 8 2 3 9 4 4 10 3 2 11 1 3 12 3 4 13 4 2 14 1 1 15 tf = logical 0

4   Pass
a = ... [ 0 5 12 3 15 2 9 6 8 11 4 13 1 14 7 10]; tf_correct = true; assert(isequal(knights_tour(a),tf_correct))

sm = 4 1 1 2 2 2 1 4 3 3 3 4 1 2 5 2 4 6 4 3 7 3 1 8 2 3 9 4 4 10 3 2 11 1 3 12 3 4 13 4 2 14 2 1 15 tf = logical 1

5   Pass
a = [22 29 4 31 16 35;3 32 23 34 5 14;28 21 30 15 36 17;9 2 33 24 13 6;20 27 8 11 18 25;1 10 19 26 7 12]; tf_correct = true; assert(isequal(knights_tour(a),tf_correct))

sm = 6 1 1 4 2 2 2 1 3 1 3 4 2 5 5 4 6 6 6 5 7 5 3 8 4 1 9 6 2 10 5 4 11 6 6 12 4 5 13 2 6 14 3 4 15 1 5 16 3 6 17 5 5 18 6 3 19 5 1 20 3 2 21 1 1 22 2 3 23 4 4 24 5 6 25 6 4 26 5 2 27 3 1 28 1 2 29 3 3 30 1 4 31 2 2 32 4 3 33 2 4 34 1 6 35 3 5 36 tf = logical 1

6   Pass
a = [22 29 4 31 16 35;3 32 23 34 5 14;28 21 30 15 0 17;2 9 33 24 13 6;20 27 8 11 18 25;1 10 19 26 7 12]; tf_correct = false; assert(isequal(knights_tour(a),tf_correct))

sm = 6 1 1 4 1 2 2 1 3 1 3 4 2 5 5 4 6 6 6 5 7 5 3 8 4 2 9 6 2 10 5 4 11 6 6 12 4 5 13 2 6 14 3 4 15 1 5 16 3 6 17 5 5 18 6 3 19 5 1 20 3 2 21 1 1 22 2 3 23 4 4 24 5 6 25 6 4 26 5 2 27 3 1 28 1 2 29 3 3 30 1 4 31 2 2 32 4 3 33 2 4 34 1 6 35 tf = logical 0

7   Pass
a = [1 0 0;0 0 0;2 0 0]; tf_correct = false; assert(isequal(knights_tour(a),tf_correct))

sm = 1 1 1 3 1 2 tf = logical 0