I’m still messing with the Rubik’s Cube and Java3D every now and then, so here’s an update. Instead of making the cubies actually rotate, I just decided to make them change color. And instead of bothering to keep track of all the cubies and change the colors, I instead just decided to display the cube as a BranchGraph, and then remove the BranchGraph and generate a new one when you twist a side. Result, the colors of the cubies change. Not the best way to do it probably, but it works well enough. In order to rotate a side I’d need to have cubies in more than one transform group, delays to not rotate one side until another side is done rotating, and regenerating the transform groups every twist anyway because the same cubies would no longer be on the same faces. I’ll save that for version 2…
At the top you have controls to reset the cube to a solved state, scramble the cube, and display either a black Rubik’s Cube or a see through Rubik’s Cube. In the center, we have the Rubik’s Cube itself, can be rotated, moved, and zoomed using the mouse. The right is a list of text values describing the arrays, and on the bottom is an entry box which will allow values f, f’, b, b’, l, l’, r, r’, t, t’, d, d’, rotating the sides either clockwise or counterclockwise. You can either enter one value at a time or a handful of values seperated by spaces. Everything works fine and I declare it version 0.1!
And you can find the Rubik’s Cube in it’s current version here,
Note: it will NOT work at this moment without downloading and installing the Java 3D API first. It’s a small and fast install though.
To do list:
- Display the sides not visable by means of some sort of mirror.
- Program the methods to actually solve the cube and display how.
- Create user entry mode so people can program in their own cube permutation to be solved.
- Run without the need for users to download Java 3D manually.
I’ll get right on that… after writing up an EE120 lab report, doing MAT267 homework, and finishing up homework that’s actually for my Java class… and maybe watching some TV. Stay tuned for most likely the last Rubik’s Cube programming post, part 4!