Problem 892. Solve Rubik's Cube - Up to Two Face Moves
A standard Rubik's Cube is shown in 3-D and also unfolded to identify the specific Tile-face/Vector numbering.
The faces are White-Up / Red-Left / Blue-Front / Orange-Right / Yellow-Down / Green-Back (ULFRDB)
Moves are denoted as F for clockwise rotation of the Front face. F' is CCW and F2 is F twice. The loaded function r_new=rubick_rot(mov,r) implements moves 1-18: UFDLBRU'F'D'L'B'R'U2F2D2L2B2R2.
Input: (rubik)
rubik: row vector of size 54
(The cube started [L=0,U=1,F=2,D=3,B=4,R=5] and then received one or two face moves.
Output: mov (A row vector of one or two of values {1:18})
mov: is a vector values 1:18 representing the moves in order to fix the cube: UFDLBRU'F'D'L'B'R'U2F2D2L2B2R2
- Example:
- If the cube was randomized by [1 9] UD', the one and only 2 move answer is [3 7] DU' which are the complements in reverse order.
- Minimum moves is also required. Scramble by 13(U2) should return a [13], not [1 1] or [7 7]
- Verifications will be by executing your move vector against the provided rubik and checking number of moves.
The function rubik_rot(mov,r) is available for usage
This is the next incremental solution step: Move optimization.
Additional Challenges will be solving the cube at even deeper depths for time and minimizing face moves utilized. This depth does not justify a time check.
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
Nikolaos Nikolaou
on 18 Jul 2020
doesnt load rubic_rot :(
Richard Zapor
on 29 Sep 2020
fixed tinyurl. Sourcing from my googlepage. 9/29/2020
Nikolaos Nikolaou
on 17 Apr 2022
I think the test suit is still problematic :)
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
Increment a number, given its digits
650 Solvers
-
Arrange Vector in descending order
11272 Solvers
-
298 Solvers
-
"Low : High - Low : High - Turn around " -- Create a subindices vector
540 Solvers
-
317 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!