Cody

Solution 2514263

Submitted on 10 Jun 2020 by Jerry Wright
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))

pt = 3 1 pt = 3 1 possible = 1 2 possible = 1 2 df = -2 1 x = 3 pt = 1 2 possible = 3 3 possible = 3 3 df = 2 1 x = 4 pt = 3 3 possible = 2 1 possible = 2 1 df = -1 -2 x = 5 pt = 2 1 possible = 1 3 possible = 1 3 df = -1 2 x = 6 pt = 1 3 possible = 3 2 possible = 3 2 df = 2 -1 x = 7 pt = 3 2 possible = 1 1 possible = 1 1 df = -2 -1 x = 8 pt = 1 1 possible = 2 3 possible = 2 3 df = 1 2 x = 9 pt = 2 3

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

pt = 1 1 pt = 1 1 possible = 2 3 possible = 2 3 df = 1 2 x = 3 pt = 2 3

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

pt = 4 1 pt = 4 1 possible = 2 2 possible = 2 2 df = -2 1 x = 3 pt = 2 2 possible = 1 4 possible = 1 4 df = -1 2 x = 4 pt = 1 4 possible = 3 3 possible = 3 3 df = 2 -1 x = 5 pt = 3 3 possible = 1 2 possible = 1 2 df = -2 -1 x = 6 pt = 1 2 possible = 2 4 possible = 2 4 df = 1 2 x = 7 pt = 2 4 possible = 4 3 possible = 4 3 df = 2 -1 x = 8 pt = 4 3 possible = 3 1 possible = 3 1 df = -1 -2 x = 9 pt = 3 1 possible = 2 3 possible = 2 3 df = -1 2 x = 10 pt = 2 3 possible = 4 4 possible = 4 4 df = 2 1 x = 11 pt = 4 4 possible = 3 2 possible = 3 2 df = -1 -2 x = 12 pt = 3 2 possible = 1 3 possible = 1 3 df = -2 1 x = 13 pt = 1 3 possible = 3 4 possible = 3 4 df = 2 1 x = 14 pt = 3 4 possible = 4 2 possible = 4 2 df = 1 -2 x = 15 pt = 4 2 possible = 1 1 possible = 1 1 df = -3 -1 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))

pt = 4 1 pt = 4 1 possible = 2 2 possible = 2 2 df = -2 1 x = 3 pt = 2 2 possible = 1 4 possible = 1 4 df = -1 2 x = 4 pt = 1 4 possible = 3 3 possible = 3 3 df = 2 -1 x = 5 pt = 3 3 possible = 1 2 possible = 1 2 df = -2 -1 x = 6 pt = 1 2 possible = 2 4 possible = 2 4 df = 1 2 x = 7 pt = 2 4 possible = 4 3 possible = 4 3 df = 2 -1 x = 8 pt = 4 3 possible = 3 1 possible = 3 1 df = -1 -2 x = 9 pt = 3 1 possible = 2 3 possible = 2 3 df = -1 2 x = 10 pt = 2 3 possible = 4 4 possible = 4 4 df = 2 1 x = 11 pt = 4 4 possible = 3 2 possible = 3 2 df = -1 -2 x = 12 pt = 3 2 possible = 1 3 possible = 1 3 df = -2 1 x = 13 pt = 1 3 possible = 3 4 possible = 3 4 df = 2 1 x = 14 pt = 3 4 possible = 4 2 possible = 4 2 df = 1 -2 x = 15 pt = 4 2 possible = 2 1 possible = 2 1 df = -2 -1 x = 16 pt = 2 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))

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

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

pt = 6 1 pt = 6 1 possible = 4 1 possible = 4 1 df = -2 0 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))

pt = 1 1 pt = 1 1 possible = 3 1 possible = 3 1 df = 2 0 tf = logical 0