C++ Win32 Multi-Threaded Rubik Cube Sample

The Win32_Rubik_Multi (MultiThreaded) sample is an MDI MFC application. Each child window has an unfolded view of a Rubik's cube and a 'Solve' button. When the button is pressed, the cube is randomly scrambled and then solved.

This demo was much more interesting in the days of slower machines. Now each cube solves so fast you can't get them all going at once. A good enhancement would be to add a 'Solve All' menu item that automatically sent the solve message to all the cubes so maybe a bunch could be solved at once.

The FILE/NEW menu item causes new child windows to be created, and each one is associated with a new Logic Server, running in a separate thread.

When you click the 'Solve' button in multiple windows, each one shows a cube being solved at the same (or as close to same as NT multi-threading allows) time.

This demo was derived from the Microsoft multi-threaded 'Bounce' sample, with solving Rubik's cube replacing the bouncing balls.

Building the Sample

  1. Create a project in the Eclipse IDE called cubemt in the win32_rubik_multi sample directory.
  2. Set the properties of the project (right mouse button while mouse on project in navigator) to output to rubik.xpl, not in the default bin directory.
  3. Open the Microsoft Visual C++ Project CubeMT.sln and build CubeMT.exe.

Running the Sample

  1. Run debug\CubeMT.exe (or release depending on which you built)
  2. Select File/New to create a new Rubik's cube, then click on Solve to solve it.

Copyright ©1987-2004 Amzi! inc. All Rights Reserved. Amzi! is a registered trademark and Logic Server and e-Prolog are trademarks of Amzi! inc.