Cody

Solution 1819715

Submitted on 19 May 2019
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
% Load function rubik_rot.m tic urlwrite('http://tinyurl.com/matlab-rubik-rot','rubik_rot.m') ; rehash path toc

Elapsed time is 7.450110 seconds.

2   Fail
% For mov=1 solution is 7. Need U' to solve U in 1 move % mov=1; % U answer should be 7 % Solved Cube Vector r=[0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]; r1=rubik_rot(1,r); % Create Challenge Cube mov_vec=rubik_solve(r1); for i=1:length(mov_vec) % Perform moves to see if it solves r1=rubik_rot(mov_vec(i),r1); end assert(isequal(length(mov_vec),1), [sprintf('Exp_moves=1 Exp Mov=7 moves=[') sprintf('%i ',mov_vec(:)) sprintf(']\n')]) assert(isequal(r1,r),sprintf('Exp Mov=7 moves=[%i %i]\n',mov_vec(:)))

Attempt to execute SCRIPT rubik_rot as a function: /users/mss.system.OSTzSH/rubik_rot.m Error in Test2 (line 5) r1=rubik_rot(1,r); % Create Challenge Cube

3   Fail
% For mov=14 the solution is 14. Need F2 to solve F2 in 1 move % Solved Cube Vector r=[0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]; r1=rubik_rot(14,r); % Create Challenge Cube mov_vec=rubik_solve(r1); for i=1:length(mov_vec) % Perform moves to see if it solves r1=rubik_rot(mov_vec(i),r1); end assert(isequal(length(mov_vec),1), [sprintf('Exp_moves=1 Exp Mov=14 moves=[') sprintf('%i ',mov_vec(:)) sprintf(']\n')]) assert(isequal(r1,r),sprintf('Exp Mov=14 move=[%i]\n',mov_vec(:)))

Attempt to execute SCRIPT rubik_rot as a function: /users/mss.system.OSTzSH/rubik_rot.m Error in Test3 (line 4) r1=rubik_rot(14,r); % Create Challenge Cube

4   Fail
% Starting Cube Vector r=[0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]; r1=rubik_rot(2,r); % Create Challenge Cube, First Twist r1=rubik_rot(9,r1); % Create Challenge Cube, Second Twist mov_vec=rubik_solve(r1); for i=1:length(mov_vec) % Perform moves to see if it solves r1=rubik_rot(mov_vec(i),r1); end assert(isequal(length(mov_vec),2), [sprintf('Exp_moves=2 Exp Mov=[3 8] moves=[') sprintf('%i ',mov_vec(:)) sprintf(']\n')]) assert(isequal(r1,r),sprintf('Exp Mov=[3 8] moves=[%i %i]\n',mov_vec(:)))

Attempt to execute SCRIPT rubik_rot as a function: /users/mss.system.OSTzSH/rubik_rot.m Error in Test4 (line 4) r1=rubik_rot(2,r); % Create Challenge Cube, First Twist

5   Fail
% Anti-Hard code solution Test Case #1 cmov=[7:12 1:6 13:18]; % Complementary Move % Starting Cube Vector r=[0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]; move_map=[ 2 3 4 5 6 8 9 10 11 12 14 15 16 17 18; 1 3 4 5 6 7 9 10 11 12 13 15 16 17 18; 1 2 4 5 6 7 8 10 11 12 13 14 16 17 18; 1 2 3 5 6 7 8 9 11 12 13 14 15 17 18; 1 2 3 4 6 7 8 9 10 12 13 14 15 16 18; 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 ; 2 3 4 5 6 8 9 10 11 12 14 15 16 17 18; 1 3 4 5 6 7 9 10 11 12 13 15 16 17 18; 1 2 4 5 6 7 8 10 11 12 13 14 16 17 18; 1 2 3 5 6 7 8 9 11 12 13 14 15 17 18; 1 2 3 4 6 7 8 9 10 12 13 14 15 16 18; 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 ; 2 3 4 5 6 8 9 10 11 12 14 15 16 17 18; 1 3 4 5 6 7 9 10 11 12 13 15 16 17 18; 1 2 4 5 6 7 8 10 11 12 13 14 16 17 18; 1 2 3 5 6 7 8 9 11 12 13 14 15 17 18; 1 2 3 4 6 7 8 9 10 12 13 14 15 16 18; 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 ]; movt1=randi(18); movt2=move_map(movt1,randi(15));% Avoid complementary moves r1=rubik_rot(movt1,r); % Create Challenge Cube: First Turn r1=rubik_rot(movt2,r1); % Create Challenge Cube: Second Turn mov_vec=rubik_solve(r1); for i=1:length(mov_vec) % Perform moves to see if it solves r1=rubik_rot(mov_vec(i),r1); end assert(isequal(length(mov_vec),2), [sprintf('Exp_moves=2 Exp Mov=[%i %i] moves=[',cmov(movt2),cmov(movt1)) sprintf('%i ',mov_vec(:)) sprintf(']\n')]) assert(isequal(r1,r),sprintf('Exp Mov=[%i %i] moves=[%i %i]\n',cmov(movt2),cmov(movt1),mov_vec(:)))

Attempt to execute SCRIPT rubik_rot as a function: /users/mss.system.OSTzSH/rubik_rot.m Error in Test5 (line 30) r1=rubik_rot(movt1,r); % Create Challenge Cube: First Turn

6   Fail
% Anti-Hard code solution Test Case #2 cmov=[7:12 1:6 13:18]; % Complementary Move % Starting Cube Vector r=[0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]; move_map=[ 2 3 4 5 6 8 9 10 11 12 14 15 16 17 18; 1 3 4 5 6 7 9 10 11 12 13 15 16 17 18; 1 2 4 5 6 7 8 10 11 12 13 14 16 17 18; 1 2 3 5 6 7 8 9 11 12 13 14 15 17 18; 1 2 3 4 6 7 8 9 10 12 13 14 15 16 18; 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 ; 2 3 4 5 6 8 9 10 11 12 14 15 16 17 18; 1 3 4 5 6 7 9 10 11 12 13 15 16 17 18; 1 2 4 5 6 7 8 10 11 12 13 14 16 17 18; 1 2 3 5 6 7 8 9 11 12 13 14 15 17 18; 1 2 3 4 6 7 8 9 10 12 13 14 15 16 18; 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 ; 2 3 4 5 6 8 9 10 11 12 14 15 16 17 18; 1 3 4 5 6 7 9 10 11 12 13 15 16 17 18; 1 2 4 5 6 7 8 10 11 12 13 14 16 17 18; 1 2 3 5 6 7 8 9 11 12 13 14 15 17 18; 1 2 3 4 6 7 8 9 10 12 13 14 15 16 18; 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 ]; mov2t1=randi(18); mov2t2=move_map(mov2t1,randi(15));% Avoid complementary moves r1=rubik_rot(mov2t1,r); % Create Challenge Cube: First Turn r1=rubik_rot(mov2t2,r1); % Create Challenge Cube: Second Turn mov_vec=rubik_solve(r1); for i=1:length(mov_vec) % Perform moves to see if it solves r1=rubik_rot(mov_vec(i),r1); end assert(isequal(length(mov_vec),2), [sprintf('Exp_moves=2 Exp Mov=[%i %i] moves=[',cmov(mov2t2),cmov(mov2t1)) sprintf('%i ',mov_vec(:)) sprintf(']\n')]) assert(isequal(r1,r),sprintf('Exp Mov=[%i %i] moves=[%i %i]\n',cmov(mov2t2),cmov(mov2t1),mov_vec(:)))

Attempt to execute SCRIPT rubik_rot as a function: /users/mss.system.OSTzSH/rubik_rot.m Error in Test6 (line 30) r1=rubik_rot(mov2t1,r); % Create Challenge Cube: First Turn