The program solves rubik's cubes, bouncing them around the screen:
The algorithm is the same I first learned to use when solving the cube by hand - the original Singmaster method - and it's far from optimal. I recorded sequences of moves interactively using a built-in "move editor", then wrote code that analysed the state of the cube and chose the algorithm to play back. The debug mode output looks something like this:
- As a first contact with the world of hardware abstraction layers, in terms of API design, OpenGL and GLUT are infinitely friendlier than DirectX 5.0.
- Do read your employment contracts closely. I got into somewhat serious trouble for posting a copy of this on NeHe, believing the IP belonged to me since I had created it on my own time. Not so.
- A 2,300 line switch statement does not constitute "artificial intelligence". (I still laugh this one today. In my defense, it's not because I didn't know better in terms of design; it's more that I was still learning so much about the language at the moment that there were more pressing points than learning about the constructs which would have enabled me to organise my code in a cleaner fashion.)