[Community puzzle] 2×2×2 Rubik’s cube movements


#1

This topic is about the puzzle 2×2×2 Rubik’s cube movements.

Feel free to send your feedback or ask some help here!


#2

At last could apply the knowledge of matrix rotation operators somewhere :slight_smile: Loved this puzzle!


#3

Thank you. :wink:


#4

I think this sentence is missing a verb: “The moves in one single line, for example B’ eventually with dots (for human readability, you can ignore them).”

Can you clarify? Thanks.


#5

It’s in the I/O section, it’s not really expected to be a sentence.

Weirdest part of this sentence (but you can get used to it easily) is the French use of “eventually” to actually mean “possibly”.


#6

OK, edited.


#7

Thanks. I’m francophone, but out of practice. Been living here too long.


#8

I am not able to pass the last validator. I checked my code by printing all 6 faces for each possible movement and everything looks good. I am wondering if I misunderstood something. Hint?

:slight_smile:


#9

Does your code work if the input contains a dot after F/B/L/R/U/D/2?


#10

Yes. My understanding is that the dot can be ignored. I am able to pass the given test case “R2L2UD’.F2B2UD’” which has a dot in it. I put a dot after one of the 2 and it still passes.


#11

Have you tested/checked your code regarding the moves which do not appear in any of the test cases e.g. F’, B’, L’, U’, D and D2?


#12

EvilGenius008, a tip: what if every single square had a unique id?


#13

Hi. I think I must be misintrepreting the moves.
Would you mind correcting me?

front: turn the entire cube clockwise
back: turn the entire cube clockwise (is this a trick description?)
up: turn the upper half part of the cube clockwise
down: turn the lower half of the cube clockwise
left: turn the left part of the cube upward
right: turn the right part of the cube upward

{any}2: repeat any twice
{any}’: repeat any but in the reverse direction


#14

Nope. Turn the back face clockwise if you look at the cube from the back.


#15

That made me get it! I completely forgot rotations!
Whoops. Thanks! =D


#16

I am having the same problem with the last validator, i have now tried everything that i came to think of, and still haven’t found any errors in my output… do you have a hint if you have solved it by now? :confused:


#18

All tests passed OK during test phase, though all validation tests failed. Why?


#19

It’s easy to mess up the rotation directions, while there are very few testcases. Here are a few more (random) examples to help debugging.

BB2U
RU
FF

U2B2RL2UU
UF
BU

RR'R'B
FU
FU

ULR2L'B'
RB
FL

F2U'B'
LR
FF

U'F2
FF
LL

DB
FF
LL

LF2UD'
LR
LR

B'U'DU2
RU
DL

F'R2L'
LB
DB

#20

Thanks for the test values. I just received my rubik’s cube 222 ordered 2 days ago as well, I have put stickers on each face of my cube with face name and cube number… And I could find my bug (prime movement was treated similar as non prime movement in cube new position) and added a small code to handle that:

self.moveDict = {“R”: {2: 6, 6: 7, 7: 3, 3: 2},
“L”: {5: 1, 1: 4, 4: 8, 8: 5},
“U”: {1: 5, 5: 6, 6: 2, 2: 1},
“D”: {4: 3, 3: 7, 7: 8, 8: 4},
“F”: {1: 2, 2: 3, 3: 4, 4: 1},
“B”: {7: 6, 6: 5, 5: 8, 8: 7}}
tmpDict = self.moveDict.copy()
for face in tmpDict:
primeFace = “{}’”.format(face)
tab = dict()
for key, value in self.moveDict[face].items():
tab[value] = key
self.moveDict[primeFace] = tab


#21

I believe there is a typo in the last test case: it should be “LB/DB”, not “RB/DB”.
Thanks for providing these btw, they helped me a lot to debug my code.