[Community Puzzle] 1×1×1 Rubik’s cube movements

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Good morning everyone, I am trying to solve this pretty easy puzzle, I do not get issues with the tests, but i stuck myself to only 33% when i submit it. I think it could be related to a different way to consider the rotations, here is what i considered:
considering a clockwise and counter-clockwise watching from the origin to the direction of the axis following a “right hand” approach, I said that:
rotation x:
F becomes U
rotation y:
F becomes L
rotation z:
U becomes R.

(I considered rotations clockwise up there).

Is this, by your point of view correct?

Do you have some kind of other inputs, else, about what I should check to verify the code to work correctly?

This is indeed correct. Your problem has to be somewhere else…
If you publish one custom input file here, I can publish the associated correct output in return.

Hello, i have an issue. the face_1 and face_2 are not filled with letters, when i try to printf them, i get nothing, and sometimes i get the x, y and z notations. I used all the following lines:

printf(“%c\n”, face_1[0]);
printf(“%c\n”, face_1[1]);
printf(“%c\n”, face_1[2]);
printf(“%s\n”, face_1);

I also print with strlen face_1 and face_2 and i found only 1 (for the ‘\0’).

@AchrafLy That’s the usual problem with the stub generator in C: either the buffer sizes are wrong or the endline eating is not properly dealt with (depending on the way you see things). Anyway it very often does not work. Here is an example of a proper input parsing for this problem (/!\ endlines are read here):

int main()
    char rotations[102];
    fgets(rotations, 102, stdin);
    char face_1[3];
    fgets(face_1, 3, stdin);
    char face_2[3];
    fgets(face_2, 3, stdin);

    printf("%s\n", rotations);
    printf("%s\n", face_1);
    printf("%s\n", face_2);

    return 0;

Thanks Niako :smiley: