17
1
Introduction:
I'm a twisty puzzles collector. Here you can see my current collection of ± 300 puzzles.
I think everyone knows the regular Rubik's Cube (3x3x3 Cube), which is a NxNxN Cube. There are also Cuboids (block-shaped puzzles), which come in different forms, perhaps better explained by SuperAntionioVivaldi here:
- Regular Domino Cuboids (like the 2x2x3; 2x3x3; 3x3x4; etc.) - They come in the form of NxNx(N+O) or Nx(N+O)x(N+O), which have either two odd dimensions and an even, or two even and an odd.
- Shapeshifter Cuboids (like the 2x2x4; 3x3x5; 3x3x9; 4x4x6; etc.) - They come in the form of NxNx(N+P), which as the name suggests, shapeshifts (in all directions). All three dimensions are either odd or even.
- Floppy Cuboids (like the 1x3x3; 2x4x4; etc.) - They come in the form of Nx(N+P)x(N+P), which are almost the same as the Shapeshifters, but with so-called Floppy Parities.
- Brick Cuboids (like the 2x3x4; 3x4x5; 2x3x5; etc.) - They come in the form of Nx(N+O)x(N+P), which just like the Regular Domino Cuboids have either two odd dimensions and an even, or two even and an odd; but don't have any of the same dimensions.
- Ultimate Shapeshifters (like the 2x4x6; 3x5x7; 2x4x10; etc.) - They come in the form of Nx(N+O)x(N+R), and shapeshift in any direction. All three dimensions are either odd or even; but don't have any of the same dimensions.
Challenge:
Input:
A positive integer n with the following restriction: 8 <= n <= 125.
n can be uniquely decoded as the product of three values (the dimensions), of which each is between 2 and 5 inclusive.
The reason I've restricted it to 2-5 is to prevent duplicated inputs (like 1x2x4 = 8
and 2x2x2 = 8
), even though there are many lower/higher order Cuboids out there. This also means there are no test cases for Ultimate Shapeshifters.
Output / Test cases:
These are all the cases your program/function should support, ranging from edge lengths 2 through 5 in every possible three-dimensional configuration:
Input Cuboid/Cube Type/Output
8 2x2x2 Cube
12 2x2x3 Regular Domino Cuboid
16 2x2x4 Shapeshifter Cuboid
20 2x2x5 Regular Domino Cuboid
18 2x3x3 Regular Domino Cuboid
24 2x3x4 Brick Cuboid
30 2x3x5 Brick Cuboid
32 2x4x4 Floppy Cuboid
40 2x4x5 Brick Cuboid
50 2x5x5 Regular Domino Cuboid
27 3x3x3 Cube
36 3x3x4 Regular Domino Cuboid
45 3x3x5 Shapeshifter Cuboid
48 3x4x4 Regular Domino Cuboid
60 3x4x5 Brick Cuboid
75 3x5x5 Floppy Cuboid
64 4x4x4 Cube
80 4x4x5 Regular Domino Cuboid
100 4x5x5 Regular Domino Cuboid
125 5x5x5 Cube
Challenge rules:
- Any non-Cube/non-Cuboid input within the 8-125 range should result in 'none' as output.
- The output format is your own choice. I think the most reasonable is integers, like
0
= 'none';1
= Cube;2
= Regular Domino Cuboid;3
= Shapeshifter Cuboid;4
= Floppy Cuboid;5
= Brick Cuboid. Any other output format is also fine, as long as you specify which one you've used.
General rules:
- 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, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.
- Default Loopholes are forbidden. (NOTE: Since I don't know if there is a smart formula for the input-to-output conversion, it is allowed to hardcode the answers based on the input.)
- If possible, please add a link with a test for your code.
- Also, please add an explanation if necessary.
2Been in the sandbox since October 2016. – Kevin Cruijssen – 2017-02-08T09:35:18.397
1There is no helicopter cube in your collection? – G B – 2017-02-08T11:24:57.063
@GB Nope. I do have a Curvy Copter, Curvy Copter Plus, Curvy Copter III, Curvy Chop Cube, Helicopter Dodecahedron and custom-made Super Truncated Curvy Copter III, but no Helicopter Cube. :) It's a bit too similar to the Curvy Copter, but I might get it some day. – Kevin Cruijssen – 2017-02-08T13:30:57.387
Is the input sorted? or do we have to sort manually? – Matthew Roh – 2017-02-08T13:45:25.040
@MatthewRoh The input is a single integer (i.e.
24
), so I don't know what you want to sort about it? – Kevin Cruijssen – 2017-02-08T14:45:03.117Oh. Nevermind. I didnt see that part. – Matthew Roh – 2017-02-08T16:05:11.917