Beta

Folding a 4D Cube (tesseract)

15 of 30doooom

Description:

Folding a Tesseract

In geometry, the tesseract is the four-dimensional analogue of the cube; the tesseract is to the cube as the cube is to the square. Just as the surface of the cube consists of six square faces, the hypersurface of the tesseract consists of eight cubical cells.

Like folding a paper net into a 3D cube, a code warrior living in 4 dimensional space can fold a 3D cube net into a tesseract, for example the 3D cube net below:

If you unfortunately live in a 3D universe, folding it needs some imagination:

And here are more 3D nets that can be folded into a 4D cube. I found it's pretty fun to figure it out myself. But there is a good website which talks about how the folding mathmatically works. You will find more valid 3D net examples in this website too.

https://unfolding.apperceptual.com/

Now, let's talk about this kata. The task is simple. Your code will receive a net with 8 cubes, and will have to answer if the net can be folded into a tesseract or not.

Here we use an 8x8x8 matrix to indicate the cubes' position. The first layer of the matrix is numbered from 1 to 64, the second layer is 65 to 128, and so on. The first layer and the second look like: The input of the net below could be a list:

[10, 74, 73, 75, 66, 82, 138, 202]  ->  True

10 is the very top cube.

74 is the one right below 10.

73, 75, 66 and 82 are the four surrounding 74.

While 138 and 202 are the two underneath 74.

  • The input will always be a list with 8 numbers.
  • All input nets are within this 8x8x8 matrix.

Constraints

Your code length should be shorter than 3000 characters.


Have fun!


Some hints if you need...

  • THIS is about how I fold the 3D nets in my mind. It's not a part of this kata, so I put it on my github.
  • There is a simpler kata of folding 2D nets into a 3D cube. Solving it will help this kata in a higher dimension. However if you like the genuine full challenge, try not to solve the 3d version first :)
Geometry
Puzzles

Similar Kata:

More By Author:

Check out these other kata created by doooom

Stats:

CreatedAug 18, 2020
PublishedAug 19, 2020
Warriors Trained355
Total Skips44
Total Code Submissions568
Total Times Completed30
Python Completions15
JavaScript Completions16
C Completions2
C++ Completions4
Total Stars32
% of votes with a positive feedback rating93% of 14
Total "Very Satisfied" Votes13
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes1
Total Rank Assessments10
Average Assessed Rank
2 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
3 kyu
Ad
Contributors
  • doooom Avatar
  • Blind4Basics Avatar
Ad