in reply to Challenge: "Insanity" Cube Puzzle
Here's my solution in the J programming language. The cubes in the example are defined near the beginning, but you can use any other cube colorings you wish. My solution uses brute force and is unoptimized, but on a modern machine it still runs within a few seconds so I don't care.
The output lists all the solutions and then gives the number of solutions just in case there are so many they scrolled out of the screen. Each solution is the list of four rotated cubes each given as six colors like in the input. The output is in spoiler tags.
Update: Let's compare the output with that of some of the other solutions posted in this thread.
Most of the solutions just output the solution in a format similar to ours, except sometimes only the four visible sides are shown, so I visually compared one of their outputs to mine directly, and guessed the rest of the solutions they find would match as well. This table form is handy.
<"2 solns +------+------+------+------+------+------+------+------+ |ggyrpp|grygpp|yggrpp|yrggpp|ggrypp|gyrgpp|rggypp|ryggpp| |pyrgrr|pgryrr|rypgrr|rgpyrr|ypgrrr|yrgprr|gpyrrr|gryprr| |yrppgy|yppryg|prypyg|ppyrgy|ryppyg|rppygy|pyrpgy|ppryyg| |rpgyry|rygpyr|gpryyr|gyrpry|prygyr|pgyrry|yrpgry|ygpryr| +------+------+------+------+------+------+------+------+
To compare with the output of tye's script, we convert each solution to the format of his output. We can't use just the normalized solution because tye's script normalizes in a different way.
,/"2,"1&' ' |:"2 (1 3 0 2){"1 solns gyrp rgpy gpyr yrpg rgpy gyrp gpyr yrpg gyrp rgpy yrpg gpyr rgpy gyrp yrpg gpyr gpyr yrpg gyrp rgpy yrpg gpyr gyrp rgpy gpyr yrpg rgpy gyrp yrpg gpyr rgpy gyrp
Indeed, output for index 4 is equal to tye's output.
I've checked the output of most solutions in this thread, and each seems to give at least one correct solution, or at most sneaked in so typos so smartly that I didn't notice them in my not too rigorous comparision. I don't yet understand the output of solutions in L~R's second order reply.
Update: I cross-posted a description of the puzzle and my solution to the J wiki: Essays/InsanityCube.
Update 2010-11-29: has anyone linked to the description of this puzzle (called Instant Insanity there) on Jaap's puzzle page?
|
---|