### Random Post

### Recent Posts

### Recent Comments

geoffrounce on Enigma 440: Three X | |

Jim Randell on Enigma 1588: As easy as 1… | |

Jim Randell on Enigma 440: Three X | |

geoffrounce on Enigma 1106: Not a square… | |

Jim Randell on Tantalizer 458: Knifemen |

### Archives

### Categories

- article (11)
- enigma (1,156)
- misc (2)
- project euler (2)
- puzzle (39)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,401 hits

Advertisements

The following Python program computes the number of different 2-coloured cubes in each box, and which of these can be used as vertices in the 2×2×2 cubes, then — assuming the three nephews construct two 2×2×2 cubes of one colour and one of the other colour — it calculates how many boxes are required, and how many of the smaller cubes remain. It’s not particularly elegant, but it does the job in 35ms.

Solution:There were 24 cubes left over.For sure not very elegant.

How long did it take to write the program, well written indeed.

Next time you may not use a nuclear weapon to solve such enigma

I wrote the program after solving the puzzle by hand, so the program is really just going through the steps I did manually – I didn’t want it to end up on my list of Enigmas that I’ve not solved programatically.

Once you’ve worked out which of the smaller cubes can be used to construct the larger cubes the solution is straightforward, so I decided to make it a more interesting programming challenge by deriving the rotations of the cube, and the set of different 2-colourings from scratch. I was hoping to come up with a neater way of generating all the rotations of the cube, but in the end – inspired by playing with a Rubik’s cube – I did it mechanically based on the rotations around each axis.

The program verifies the solution that I did manually, so I’m happy.

Thanks for your comment.

I downloaded your enigma.py library. Plenty of good tools.

I had an issue copying your solver for the 2x2x2 cube as some variables were not seen as global. I have still a lot to learn to use Python correctly.

Have a nice day

I’ve verified the code posted above (and the latest enigma.py library) runs on Python 2 and Python 3 (using 2.7.3 and 3.3.0 on OS X, 2.7.3 and 3.2.3 on Linux), so maybe there’s a problem with your Python installation? If you’re still having problems you could drop me an email with the error message your getting, but I’m not sure if I’ll be able to suggest anything as it all looks like it’s working at this end.

As I said previously, I have still a lot to learn. I was not my intention to suggest your program was wrong but rather to insist on the fact that I probably not run it as it shoul. Enjoy your day.