Cody

Problem 1512. Clock Solitaire

Solution 2634280

Submitted on 30 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
deck = [1:52]; assert(isequal(clockSolitaire(deck),false))

deck = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 Columns 31 through 52 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 7 8 9 10 11 12 13 count = 3 ans = 1 ans = 2 ans = 3 ans = 4 ans = 5 5 ans = 6 6 ans = 7 ans = 8 8 ans = 9 ans = 10 10 10 ans = 11 ans = 12 12 ans = 13 13 13

Output argument "isWinner" (and maybe others) not assigned during call to "clockSolitaire". Error in Test1 (line 2) assert(isequal(clockSolitaire(deck),false))

2   Fail
deck = [8 1 5 2 30 23 46 21 3 51 6 27 42 48 37 33 12 25 45 36 31 34 29 35 15 17 43 13 39 40 18 50 26 9 4 28 38 16 11 22 49 24 14 7 32 20 47 44 19 10 41 52]; assert(isequal(clockSolitaire(deck),true))

deck = Columns 1 through 30 8 1 5 2 4 10 7 8 3 12 6 1 3 9 11 7 12 12 6 10 5 8 3 9 2 4 4 13 13 1 Columns 31 through 52 5 11 13 9 4 2 12 3 11 9 10 11 1 7 6 7 8 5 6 10 2 13 t = 2 t = 2 t = 2

Matrix index is out of range for deletion. Error in clockSolitaire (line 32) C{t}(1)=[]; Error in Test2 (line 2) assert(isequal(clockSolitaire(deck),true))

3   Fail
deck = [52:-1:1]; assert(isequal(clockSolitaire(deck),false))

deck = Columns 1 through 30 13 12 11 10 9 8 7 6 5 4 3 2 1 13 12 11 10 9 8 7 6 5 4 3 2 1 13 12 11 10 Columns 31 through 52 9 8 7 6 5 4 3 2 1 13 12 11 10 9 8 7 6 5 4 3 2 1 t = 1

Matrix index is out of range for deletion. Error in clockSolitaire (line 32) C{t}(1)=[]; Error in Test3 (line 2) assert(isequal(clockSolitaire(deck),false))

4   Fail
deck = [40 29 25 37 23 41 13 50 33 2 42 20 49 48 27 46 36 45 28 1 7 11 14 5 9 26 15 21 12 8 19 35 10 38 34 52 32 51 31 16 18 22 6 3 47 44 43 4 24 17 30 39]; assert(isequal(clockSolitaire(deck),true))

deck = Columns 1 through 30 1 3 12 11 10 2 13 11 7 2 3 7 10 9 1 7 10 6 2 1 7 11 1 5 9 13 2 8 12 8 Columns 31 through 52 6 9 10 12 8 13 6 12 5 3 5 9 6 3 8 5 4 4 11 4 4 13 count = 3 ans = 1 1 1 ans = 2 2 2 ans = 3 3 3 ans = 4 4 ans = 5 5 5 ans = 6 6 6 ans = 7 ans = 8 8 ans = 9 9 ans = [] ans = 11 11 11 11 ans = 12 12 ans = 13 13 13

Output argument "isWinner" (and maybe others) not assigned during call to "clockSolitaire". Error in Test4 (line 2) assert(isequal(clockSolitaire(deck),true))

5   Fail
deck = [40 29 25 37 23 41 13 50 33 2 42 20 52 48 27 46 36 45 28 1 7 11 14 5 9 26 15 21 12 8 19 35 10 38 34 49 32 51 31 16 18 22 6 3 47 44 43 4 24 17 30 39]; assert(isequal(clockSolitaire(deck),false))

deck = Columns 1 through 30 1 3 12 11 10 2 13 11 7 2 3 7 13 9 1 7 10 6 2 1 7 11 1 5 9 13 2 8 12 8 Columns 31 through 52 6 9 10 12 8 10 6 12 5 3 5 9 6 3 8 5 4 4 11 4 4 13 count = 3 ans = 1 1 1 ans = 2 2 2 ans = 3 3 3 ans = 4 4 ans = 5 5 5 ans = 6 6 6 ans = 7 ans = 8 8 ans = 9 9 ans = [] ans = 11 11 11 11 ans = 12 12 ans = 13 13 13

Output argument "isWinner" (and maybe others) not assigned during call to "clockSolitaire". Error in Test5 (line 2) assert(isequal(clockSolitaire(deck),false))

6   Fail
deck = [8 1 5 2 30 23 46 21 3 51 6 27 13 48 37 33 12 25 45 36 31 34 29 35 15 17 43 42 39 40 18 50 26 9 4 28 38 16 11 22 49 24 14 7 32 20 47 44 19 10 41 52]; assert(isequal(clockSolitaire(deck),false))

deck = Columns 1 through 30 8 1 5 2 4 10 7 8 3 12 6 1 13 9 11 7 12 12 6 10 5 8 3 9 2 4 4 3 13 1 Columns 31 through 52 5 11 13 9 4 2 12 3 11 9 10 11 1 7 6 7 8 5 6 10 2 13 t = 10 t = 10 t = 10

Matrix index is out of range for deletion. Error in clockSolitaire (line 32) C{t}(1)=[]; Error in Test6 (line 2) assert(isequal(clockSolitaire(deck),false))

Suggested Problems

More from this Author11

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!