data structures - How would you represent a Rubik's Cube in code? -


If you are developing software to solve a Rubik cube, how would you represent the cube?

It describes several alternative ways that it has used to represent Rubeck's cube And they compare them against each other. Sadly, I do not have an account to get the full text, but the description says:

Seven alternative representations of the Rubik's cube have been presented and compared: one Array of 3-by-3-by-3 3-digit integers; A 6-by-3-by-3 array literally; A 5-B-12 verbal matrix; A ll-by-ll Sparse literal matrix; 54-element vector; A 4-dimension array; And 3-by-3-by-3 nested arrays. The APL function has been provided for many useful tools along with quarter-twist for guideline and for solution of cube.

In addition, this file contains a very clean representation with the relevant code to rotate sections (if you are looking for the actual code) it uses the cell And faces the array.


Comments