02-24-2005, 03:23 AM
Here's another idea for a challenge I had which should get the brain stirring without asking the impossible.
The challenge is to write a program which takes as input a rubik's cube, and a list of moves, and the program must then perform the list of moves on the inputted cube, and then return whether the cube is solved or not.
This is distinctly DIFFERENT from a program which actually solves the cube (which might seem at first impossible, although if you complete this challenge you'll find you're more than half-way there).
The input looks like this:
and the output would be
if "top left" had been "top right" then the output would be
"unsolved"
So as you can see, the cube is inputted as an unfolded map, with each color represented by a number 1-6 (although if you really want to make it versatile, make the program take any 6 unique characters as input). The faces go in this order:
The possible moves are:
obviously, "end" means no more input.
(if you're wondering, "rear clockwise" means clockwise when looking at it from the front, not from the rear).
And the definition of "solved" means:
a solid color on each face, but it doesn't matter which color is on which face.
(so you don't need to worry about things like center rotations and other parity problems)
Again, the program only needs to output whether the ending position is solved or not (and it must do so accurately), nothing more, nothing less.
And for the usual disclaimer, I'm not trying to get others to do my homework (yes, Nemesis, I have already done this one as well). It's just a good way to get the mental juices flowing.
You may post your code in reply to this topic, or email me. I'll probably set up a page on my site for this challenge and post winners.
You may write the program in any language you desire, so long as it can take input from the console as I specified, and prints output to the console (dos screen/linux shell).
Happy coding
-- Eric / neuro
The challenge is to write a program which takes as input a rubik's cube, and a list of moves, and the program must then perform the list of moves on the inputted cube, and then return whether the cube is solved or not.
This is distinctly DIFFERENT from a program which actually solves the cube (which might seem at first impossible, although if you complete this challenge you'll find you're more than half-way there).
The input looks like this:
Code:
111
111
111
555222333444
222333444555
222333444555
666
666
666
top left
end
and the output would be
Code:
solved
if "top left" had been "top right" then the output would be
"unsolved"
So as you can see, the cube is inputted as an unfolded map, with each color represented by a number 1-6 (although if you really want to make it versatile, make the program take any 6 unique characters as input). The faces go in this order:
Code:
top
left front right back
bottom
The possible moves are:
Code:
top left
top right
bottom left
bottom right
left up
left down
right up
right down
front clockwise
front counterclockwise
rear clockwise
rear counterclockwise
middle left
middle right
middle up
middle down
middle clockwise
middle counterclockwise
end
obviously, "end" means no more input.
(if you're wondering, "rear clockwise" means clockwise when looking at it from the front, not from the rear).
And the definition of "solved" means:
a solid color on each face, but it doesn't matter which color is on which face.
(so you don't need to worry about things like center rotations and other parity problems)
Again, the program only needs to output whether the ending position is solved or not (and it must do so accurately), nothing more, nothing less.
And for the usual disclaimer, I'm not trying to get others to do my homework (yes, Nemesis, I have already done this one as well). It's just a good way to get the mental juices flowing.
You may post your code in reply to this topic, or email me. I'll probably set up a page on my site for this challenge and post winners.
You may write the program in any language you desire, so long as it can take input from the console as I specified, and prints output to the console (dos screen/linux shell).
Happy coding
-- Eric / neuro