Cody

Solution 1671564

Submitted on 11 Nov 2018 by William
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
pattern = 1; y_correct = 1; assert(isequaln(siteswap(pattern),y_correct))

2   Pass
pattern = 2; y_correct = 2; assert(isequaln(siteswap(pattern),y_correct))

3   Pass
pattern = 3; y_correct = 3; assert(isequaln(siteswap(pattern),y_correct))

4   Pass
pattern = [3 3]; y_correct = 3; assert(isequaln(siteswap(pattern),y_correct))

5   Pass
pattern = [5 5 1]; y_correct = NaN; assert(isequaln(siteswap(pattern),y_correct))

6   Pass
pattern = [5 5 2]; y_correct = 4; assert(isequaln(siteswap(pattern),y_correct))

7   Pass
pattern = [3 2 1]; y_correct = NaN; assert(isequaln(siteswap(pattern),y_correct))

8   Pass
pattern = [3 1 2]; y_correct = 2; assert(isequaln(siteswap(pattern),y_correct))

9   Pass
pattern = [4 4 1]; y_correct = 3; assert(isequaln(siteswap(pattern),y_correct))

10   Pass
pattern = [5 2 1]; y_correct = NaN; assert(isequaln(siteswap(pattern),y_correct))

11   Pass
pattern = [5 5 5 0 0]; y_correct = 3; assert(isequaln(siteswap(pattern),y_correct))

12   Pass
pattern = [5 3 1]; y_correct = 3; assert(isequaln(siteswap(pattern),y_correct))

13   Pass
pattern = [6 4 5 1]; y_correct = 4; assert(isequaln(siteswap(pattern),y_correct))

14   Pass
pattern = [7 3 3 3]; y_correct = 4; assert(isequaln(siteswap(pattern),y_correct))

15   Pass
pattern = [7 1]; y_correct = 4; assert(isequaln(siteswap(pattern),y_correct))

16   Pass
pattern = [5 3 1 4 5 3 0 5 5 2 0]; y_correct = 3; assert(isequaln(siteswap(pattern),y_correct))

17   Pass
pattern = [3 4 2]; y_correct = 3; assert(isequaln(siteswap(pattern),y_correct))

18   Pass
pattern = [7 7 1]; y_correct = 5; assert(isequaln(siteswap(pattern),y_correct))

19   Pass
pattern = [1 4 0 3]; y_correct = NaN; assert(isequaln(siteswap(pattern),y_correct))

20   Pass
pattern = [1 3 0 4]; y_correct = 2; assert(isequaln(siteswap(pattern),y_correct))

21   Pass
a=randi(100) pattern = [4*a, 0, 4*a-1, 1]; y_correct = NaN; assert(isequaln(siteswap(pattern),y_correct))

a = 96

22   Pass
a=randi(100) pattern = [4*a, 0, 1, 4*a-1]; y_correct = 2*a; assert(isequaln(siteswap(pattern),y_correct))

a = 18

23   Pass
assert(isequaln(siteswap([6 0 1 5]),siteswap([6 0 5 1])))