TL;DR for those not interested: Look at the test cases at the bottom. Have a program/function that outputs the 2D list displayed for the given input.
On November 15th, 2018 puzzle designer Raphaël Mouflin revealed his Triangularity puzzle. Here is a picture of that puzzle:
As you can see, the shape is a 3-sided (4-faced) pyramid (a.k.a. tetrahedron), and it has six pieces per face.
So, what makes this puzzle so unique? It's the first puzzle in the shape of a regular platonic solid that is a hybrid of all three twisty puzzle rotational axis systems: face-turning, corner-turning, AND edge-turning. Most puzzles only have a single rotational axis system, like face-turning for the regular 3x3x3 Rubik's Cube; corner-turning for the Pyraminx; edge-turning for the Helicopter Cube; etc. Lately more hybrid puzzles are getting released of which most have two rotational axis systems combined in the same puzzle (usually face- and corner-turning, since that seems to be the easiest hybrid combination to accomplish).
There are some other puzzles with all three rotational axis, like the Truncated Icosidodecahedron or Superstar puzzles, but those use a pretty complex shape in order to accomplish that. Triangularity however is a simple 3-sided pyramid that still has all three rotational axis systems.
Here a video to show those moves.
The move we are doing, which is one of the following:
E#for an edge-turn, where
#is a digit in the range
[0,5]) for the six edges, numbered here. So the blue-red edge is 1; blue-yellow is 2; yellow-red is 3; blue-green is 4; yellow-green is 5; and red-green is 6.
F#Dfor the face-turn, where
#is a digit in the range
[0,3]) for the four faces, numbered here. So the blue face is 1; yellow face is 2; red face is 3; green face is 4. And
Dis the direction, either
C#Dfor the corner, where
#is a digit in the range
[0,3]) for the four corners, numbered here. So the blue-yellow-red corner is 1; blue-green-red corner is 2; blue-yellow-red corner is 3; yellow-red-green corner is 4. And
Dis the direction, either
Optional second input: The initial solved state 2D-array below.
The output will be the modified 2D-array after we've executed the single given move, where the initial solved configuration pictured above would be:
Where these numbers indicate the pieces per face, so (using 'outer color - inner color' to indicate the pieces): 1 and 2 are the blue-red pieces; 3 and 4 the blue-yellow pieces; 5 and 6 the blue-green; 7 and 8 the yellow-blue; 9 and 10 the yellow-red; 11 and 12 the yellow-green; 13 and 14 the red-blue; 15 and 16 the red-yellow; 17 and 18 the red-green; 19 and 20 the green-blue; 21 and 22 the green-yellow; and 23 and 24 the green-red. (Looking at the faces in a clockwise direction, the first number is the first you encounter when going clockwise, and the second number the one next to it.)
- The moves will be done in increments that doesn't change the tetrahedron shape. So even though the puzzle allows 60 degree increments for face-turns, and 90 degree increments for edge-turns, we will only do 180 degree edge turns and 120 degree face- and corner-turns so the puzzle won't shapeshift and will retain its tetrahedron shape.
- Since the challenge is mainly about executing the move, and not about compressing the initial state, you can (optionally) take the initial state as additional input.
- You are allowed to use either 1-indexed or 0-indexed numbers for the edges, faces, and corners. They do have to be consistent though, so you are not allowed to use
[1,6]for the edges, and
[0,3]for the corners. It should be either all 1-indexed or all 0-indexed. Please state what you've used in your answer.
- I/O is flexible. Input move can be a String, character-array, etc. (You are not allowed to take the input as a list of codepoints, unless you language does this implicitly.) Output can be a 2D array/list, can modify the optional input 2D array/list, can be a string, etc.
- You may optionally take the edge turns with a trailing
Aas well if it would save bytes, but the output would be the same in both cases, since the turns are in 180 degrees. (Please state so in your answer if you do take them with a trailing
Awhich is ignored.)
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
- Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
Test cases / All possible I/O (1-indexed):
Input move Output (cycled pieces) F1C [[5,6,1,2,3,4],[7,8,9,10,11,12],[13,14,15,16,17,18],[19,20,21,22,23,24]] (1→3→5→1 and 2→4→6→2 as 3-cycles) F1A [[3,4,5,6,1,2],[7,8,9,10,11,12],[13,14,15,16,17,18],[19,20,21,22,23,24]] (1→5→3→1 and 2→6→4→2 as 3-cycles) F2C [[1,2,3,4,5,6],[11,12,7,8,9,10],[13,14,15,16,17,18],[19,20,21,22,23,24]] (7→9→11→7 and 8→10→12→8 as 3-cycles) F2A [[1,2,3,4,5,6],[9,10,11,12,7,8],[13,14,15,16,17,18],[19,20,21,22,23,24]] (7→11→9→7 and 8→12→10→8 as 3-cycles) F3C [[1,2,3,4,5,6],[7,8,9,10,11,12],[17,18,13,14,15,16],[19,20,21,22,23,24]] (13→15→17→13 and 14→16→18→14 as 3-cycles) F3A [[1,2,3,4,5,6],[7,8,9,10,11,12],[15,16,17,18,13,14],[19,20,21,22,23,24]] (13→17→15→13 and 14→18→16→14 as 3-cycles) F4C [[1,2,3,4,5,6],[7,8,9,10,11,12],[13,14,15,16,17,18],[23,24,19,20,21,22]] (19→21→23→19 and 20→22→24→20 as 3-cycles) F4A [[1,2,3,4,5,6],[7,8,9,10,11,12],[13,14,15,16,17,18],[21,22,23,24,19,20]] (19→23→21→19 and 20→24→22→20 as 3-cycles) C1C [[1,8,9,4,5,6],[7,16,13,10,11,12],[3,14,15,2,17,18],[19,20,21,22,23,24]] (2→16→8→2 and 3→13→9→3 as 3-cycles) C1A [[1,16,13,4,5,6],[7,2,3,10,11,12],[9,14,15,8,17,18],[19,20,21,22,23,24]] (2→8→16→2 and 3→9→13→3 as 3-cycles) C2C [[17,2,3,4,5,14],[7,8,9,10,11,12],[13,24,15,16,19,18],[1,20,21,22,23,6]] (1→19→17→1 and 6→24→14→6 as 3-cycles) C2A [[19,2,3,4,5,24],[7,8,9,10,11,12],[13,6,15,16,1,18],[17,20,21,22,23,14]] (1→17→19→1 and 6→14→24→6 as 3-cycles) C3C [[1,2,3,20,21,6],[5,8,9,10,11,4],[13,14,15,16,17,18],[19,12,7,22,23,24]] (4→12→20→4 and 5→7→21→5 as 3-cycles) C3A [[1,2,3,12,7,6],[21,8,9,10,11,20],[13,14,15,16,17,18],[19,4,5,22,23,24]] (4→20→12→4 and 5→21→7→5 as 3-cycles) C4C [[1,2,3,4,5,6],[7,8,9,22,23,12],[13,14,11,16,17,10],[19,20,21,18,15,24]] (10→18→22→10 and 11→15→23→11 as 3-cycles) C4A [[1,2,3,4,5,6],[7,8,9,18,15,12],[13,14,23,16,17,22],[19,20,21,10,11,24]] (10→22→18→10 and 11→23→15→11 as 3-cycles) E1 [[13,14,3,4,5,6],[7,8,9,10,11,12],[1,2,15,16,17,18],[19,20,21,22,23,24]] (1↔13 and 2↔14 as swaps) E2 [[1,2,7,8,5,6],[3,4,9,10,11,12],[13,14,15,16,17,18],[19,20,21,22,23,24]] (3↔7 and 4↔8 as swaps) E3 [[1,2,3,4,5,6],[7,8,15,16,11,12],[13,14,9,10,17,18],[19,20,21,22,23,24]] (9↔15 and 10↔16 as swaps) E4 [[1,2,3,4,19,20],[7,8,9,10,11,12],[13,14,15,16,17,18],[5,6,21,22,23,24]] (5↔19 and 6↔20 as swaps) E5 [[1,2,3,4,5,6],[7,8,9,10,21,22],[13,14,15,16,17,18],[19,20,11,12,23,24]] (11↔21 and 12↔22 as swaps) E6 [[1,2,3,4,5,6],[7,8,9,10,11,12],[13,14,15,16,23,24],[19,20,21,22,17,18]] (17↔23 and 18↔24 as swaps)