# 3D tetromino placement

The following image depicts a $$5\times5\times5$$ cube. Insert any number of the pictured 3D-tetromino pieces into the cube to satisfy the conditions listed below. Pieces may be rotated in any direction. (Remember, these are three-dimensional objects so use the Z-axis as well!)

The resulting space must satisfy the following rules:

• Pieces cannot be adjacent to each other, but may touch at a corner or along edges.
• All uncoloured cells must be orthogonally connected.
• Cells with numbers must be uncoloured. The numbers give the total lengths of the runs of coloured cells, of the same colour, starting immediately adjacent to the number and extending outwards from it.
• A numbered cell cannot be orthogonally adjacent to a cell of a different colour.

Inspired by Statue View: Tetrominoes and its follow-up puzzles.

[Third try] This must be the unique solution now:

Logical deduction:

The number 4 cannot have 4 vertical pieces around it, one of these pieces will clash with the 6.
It cannot have 3 vertical pieces, since one of them will clash with the topmost number 3. Given the space, it must have 2 horizontal pieces in it's plane and one on top and bottom. So we know the top of the 4 is blue. This limits the sides of the 6, and by the pigeonhole principle certain squares must be orange. The only valid configuration of an orange piece that leaves room for the red piece is:
The red pieces can be filled in immediately
We can now find that the purple piece fits in only one way: This lets us go back and fill in the remaining blue pieces:
There are two ways that the green piece can fit, but only one way will give us room to place the remaining orange pieces:
Then adding in enough squares to make the 6:
And finally the orange piece at the bottom completes it:

• what pigeonhole principle? – Omega Krypton Jul 11 '19 at 6:53
• If I understand the rules right, there is no way to make a run without using those squares. That is, there are x available squares and y must be filled, so that forces the ones given. – Jay Jul 11 '19 at 7:07
• Are you sure about the top layer of version 2? – jafe Jul 11 '19 at 7:09
• Oh I think I spot the mistake now. I only realised version 2 was an option after I wrote this answer. – Jay Jul 11 '19 at 7:10
• Great puzzle! Waiting for the 4 dimensional version :O – Jay Jul 11 '19 at 8:21