Third-level cube Automatic Restoration VC implementation

Source: Internet
Author: User

NLP uses a mathematical method. The author of the program is the inventor of the two-phase algorithm. This algorithm is described in the document. Unfortunately, the source code of the program is not found ).

This program uses the first method.

 

The program interface is similar to cubedomain.exe(wca-assumer.zip in the folder is the compressed package of this Program)
There are bugs in the program. The program may automatically generate a ml file to save the state of the cube when a bug occurs. But it may also be other errors.
I am very grateful if you email me the automatically generated ml file (in the bug folder) or error message.

 

Comments and suggestions are welcome.

 

This program is not complete yet and is only available for learning at this stage:

  1. Restore method output not added
  2. Cube status validity detection not yet implemented

Tutorial method:

  1. Click the buttons in the interface one by one:
    Cross: implement cross on the front side, and then convert cross to the end (x ')
    L1corner: Restore the bottom corner block
    L2edge: restores the second layer.
    Topcross: Build a top-level cross
    Matchcross: good cross
    Backtopcorner
    Restoretopcorener
  2. The rotate combo box contains several common cube rotation operations, but there are too few operations. You can use the text box before the excute button to enter the rotation command. Command name conventions in command-conventions.bmp in the command reference folder.
  3. Reset cube by reset button
  4. Empty is convenient for copying cube. Click the middle block of each face to select the color. Click the non-middle block to change the color to the selected color. Because the cube validity check has not been added, if the cube becomes invalid after changing the color, the program will fail.
  5. The SAVE and open buttons are used to save and open the cube state file (*. ml)
  6. Random disrupts cube status
  7. The solution button is equivalent to executing the function corresponding to the button mentioned in step 1 consecutively.

This program tries to use two sets of methods to restore the cube, but now only one (either of the two methods can make the program run normally ). The difference between the two methods lies in the restoration of the third layer. The first two layers are the same.
The first method of cross is currently popular. The remaining steps are as follows. The author is he Meisheng from Xiamen University. The functions in the program correspond to the steps in the tutorial one by one.
The information used by this program is in the information folder.

 

The following functions
// 2: cfop
Void hasholl (char *);
Bool istopfacerestored (void );
Void oll (void );
Void hashpll (char *); // not finished
Void PLL (void );
Void cfop (void );
Is the function used in the second method, the last step
Void hashpll (char *); // not finished
Void PLL (void );
The two functions are not implemented yet.

 

Experience summary:

  1. When the state to be processed is one of many possible States and it is difficult to identify the current state, you can consider constructing a hash function to distinguish each State. Find the hash values of all possible states and the hash values of the current state, and find the hash value when identifying the current state. This method is used in the second method of restoring the top surface in this program. The State hash method can shield the State complexity. But when I think of this method, the previous program has been formed, so the first method still uses a lot of IF-else or switch to make it dizzy.
  2. This program also encountered a lot of trouble during debugging, and it was impossible to set up breakpoint debugging at the beginning. The method used later was to save the current state as a file when a function encountered a problem, open the file, and perform breakpoint debugging in the corresponding function only when the function was executed.

    We welcome the exchange of such experiences. If you think of or use other methods, please share them with you.

 

Source code download http://download.csdn.net/source/2772692

Some of my friends cannot run after downloading. it is my mistake. If vs2008 is not installed, it may not run, because the compiled vs2008 program will use several dynamic link libraries such as mfc90.dll in vs2008, I did not take this into consideration during the upload. For the time being, use your own compiler to re-compile the code. It is easy to re-compile the Code only in the header file and CPP file of cxdlg.

As for unzipping, it should be an error during download. Please download it again.

 

Program running:

1. Disrupt

 

 

2. Cross: implement cross on the front side, and then convert cross to the end (x ')

 

3. l1corner: Restore the bottom corner block

 

4. l2edge: Restore the L2 slice

 

5. topcross: Build a top-layer cross

 

6. matchcross: good cross

 

7. Back-to-Back topcorner

8. restoretopcorener restore the four-corner block

 

 

Previously, OpenGL was used to write a three-dimensional cube, but it was not automatically restored, and 360 ° angle of view conversion and rotation dynamics were not added.

In the future, Automatic Restoration may be written as 3D, which is more intuitive and cool.

 

 

========================================================== ==================

Update:

The 3D and 2D correction versions of the cube auto-Restore program have been released.

Http://blog.csdn.net/onezeros/archive/2010/10/25/5964280.aspx

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.