Cody

Problem 535. Rotate and display numbered tile

Solution 1975024

Submitted on 14 Oct 2019 by Ed P.
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
t = [1 5 7 9]; north = 3; td = [' 7 ' ' 5 9' ' 1 ']; assert(isequal(rotate_tile(t, north),td))

temp = 0×0 empty cell array t_new = 7 9 1 5 temp = 1×1 cell array {'7'} temp = 1×2 cell array {' 7'} {'9'} temp = 1×3 cell array {' 7'} {' 9'} {'1'} temp = 1×4 cell array {' 7'} {' 9'} {' 1'} {'5'}

2   Pass
t = [27 8 5 46]; north = 4; td = [' 46 ' ' 5 27' ' 8 ']; assert(isequal(rotate_tile(t, north),td))

temp = 0×0 empty cell array t_new = 46 27 8 5 temp = 1×1 cell array {'46'} temp = 1×2 cell array {'46'} {'27'} temp = 1×3 cell array {'46'} {'27'} {'8'} temp = 1×4 cell array {'46'} {'27'} {' 8'} {'5'}

3   Pass
t = [9 57 75 9]; north = 2; td = [' 57 ' ' 9 75' ' 9 ']; assert(isequal(rotate_tile(t, north),td))

temp = 0×0 empty cell array t_new = 57 75 9 9 temp = 1×1 cell array {'57'} temp = 1×2 cell array {'57'} {'75'} temp = 1×3 cell array {'57'} {'75'} {'9'} temp = 1×4 cell array {'57'} {'75'} {' 9'} {'9'}