# 3D Chess Cube - Queen Puzzle

The basis of this puzzle, is based on a common 2D chess puzzle, where you try to fit 8 queens on a chessboard without the queens being able to attack each other.

Extend this concept into a 3D cube (8x8x8... like 8 chess boards on each other), but we do analysis on both vertical and horizontal planes. So no queen can attack each other in any vertical plane or in any horizontal plane.

What is the maximum number of queens can you fit into this chess cube without them being able to attack each other. (To describe your solution, feel free to post an image showing each layer in order, or illustrate it with text of x's and o's)

• An automated search shows that it is possible to put 16 queens on an 8x8x2, but it is not possible to put 32 queens on an 8x8x4. – f'' Oct 3 '15 at 2:26
• en.m.wikipedia.org/wiki/Eight_queens_puzzle shows 92 possible solutions for the 8x8. If you tried all combinations of these in the 8x8x4 and they didn't work then that is very useful info ;) – VenomFangs Oct 3 '15 at 3:47
• It's important to cut the cube in both vertical directions for the testing. So you cut the planes in the direction of each axis. – VenomFangs Oct 3 '15 at 3:48
• Possible variation (maybe as a next question?) would be to see how many queens you can put on 6 8x8 fields on the outside of a cube. – Tim Couwelier Oct 3 '15 at 5:17
• Unless the outside affect each other then it is 48 as you can fit 8 in each side – VenomFangs Oct 5 '15 at 0:52

The maximum I've been able to find is 50.

I started off trying to get solutions by stacking various arrangements of the eight-queen solutions and filling in the leftover spaces optimally, but realized that to be a dreadfully inefficient (and far from optimal) exercise, and instead came up with a fairly straightforward recursive backtracking algorithm to populate an optimal cube.

So anyways, here's my solution:

Layer 1: Layer 2: Layer 3: Layer 4: Layer 5: Layer 6: Layer 7: Layer 8: If the pattern isn't clear, here's what the solution would look like from a "top-down" view through all eight layers. Neat stuff. • Can Queens only move in two directions in 3D space? Because from layer 1 to layer 2, it looks like L1B1 attacks L2A2 along a diagonal. If this isn't a valid move, I am curious as to why. – question_asker Nov 20 '15 at 14:08
• The way I interpreted the question, that kind of movement is not possible. I essentially divided the cube into 24 planes (8 planes along each axis) and evaluated each of those planes. So, L1B1 does not share any planes with L2A2, so the two do not interfere with each other. – Steve Eckert Nov 20 '15 at 14:19
• Suppose to consider the 1 horizontal cut and the 2 possible vertical cuts. Gives a total of 24 chess boards to check for validation after placing the Queens. Showing the 8 layers, gives enough info the figure out the rest – VenomFangs Nov 20 '15 at 14:24