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

前端 未结 11 1753
清酒与你
清酒与你 2020-12-07 09:52

If you were developing software to solve a Rubik\'s Cube, how would you represent the cube?

11条回答
  •  借酒劲吻你
    2020-12-07 10:19

    The others well addressed describing the physical cube, but regarding the state of the cube... I would try using an array of vector transformations to describe the changes of the cube. That way you could keep the history of the rubiks cube as changes are made. And I wonder if you could multiply the vectors into a transformation matrix to find the simplest solution?

提交回复
热议问题