# Visualization of Rubik's Cube Solution Algorithms 19/11/2019 ¢ ...

date post

05-Oct-2020Category

## Documents

view

0download

0

Embed Size (px)

### Transcript of Visualization of Rubik's Cube Solution Algorithms 19/11/2019 ¢ ...

EuroVis Workshop on Visual Analytics (2019) T. von Landesberger and C. Turkay (Editors)

Visualization of Rubik’s Cube Solution Algorithms

C. A. Steinparz1, A. P. Hinterreiter1 , H. Stitz1 and M. Streit1

1Johannes Kepler University Linz, Institute of Computer Graphics, Austria

Figure 1: Projected solution pathways for 100 random Rubik’s Cubes solved with the beginner’s method (left), and with Fridrich’s method (right), respectively. Data for both algorithms was combined for the t-SNE calculation, but is shown in two individual visualizations for easier interpretation. The random initial states form a broad cluster near the center of the projected state space (1). Both solution algorithms take similar intermediate paths (2), and later checkpoints cluster densely near the final solution (3). Notably, Fridrich’s algorithm avoids lengthy sequences of rotations right before the solution (4).

Abstract Rubik’s Cube is among the world’s most famous puzzle toys. Despite its relatively simple principle, it requires dedicated, carefully planned algorithms to be solved. In this paper, we present an approach to visualize how different solution algorithms navigate through the high-dimensional space of Rubik’s Cube states. We use t-distributed stochastic neighbor embedding (t-SNE) to project feature vector representations of cube states to two dimensions. t-SNE preserves the similarity of cube states and leads to clusters of intermediate states and bundles of cube solution pathways in the projection. Our prototype implementation allows interactive exploration of differences between algorithms, showing detailed state information on demand.

1. Introduction

The increasing popularity of machine learning applications has been accompanied by a growing demand for tools to visualize and help understand complex algorithms [HKPC18]. In this paper, we chose Rubik’s Cube as an example of a difficult problem solving task,

and show how a visualization can help understand different solution algorithms acting in a high-dimensional space.

Rubik’s Cube is a famous puzzle toy devised in 1974 by the Hungarian inventor and professor of architecture Ernő Rubik. With 350 million cubes sold around the world by January 2009, it is the

© 2019 The Author(s) Eurographics Proceedings © 2019 The Eurographics Association.

DOI: 10.2312/eurova.20191119 https://diglib.eg.orghttps://www.eg.org

https://orcid.org/0000-0003-4101-5180 https://orcid.org/0000-0002-4742-2636 https://orcid.org/0000-0001-9186-2092 https://doi.org/10.2312/eurova.20191119

C. A. Steinparz, A. P. Hinterreiter, H. Stitz & M. Streit / Visualization of Rubik’s Cube Solution Algorithms

world’s top-selling puzzle game [Ada09]. The classic version of Rubik’s Cube has six faces, with each face being made up by a 3×3 grid of colored facets. These facets are the faces of smaller cubes, the so-called cubies. The cube consists of 26 such cubies: 8 corner cubies with three faces each, 12 edge cubies with two faces each, and 6 center cubies with one face each. The 27th cubie at the center of the cube is replaced by a mechanism that enables rotation of one 9-cubie slice of the cube at a time. For a standard Rubik’s Cube, or any n× n× n cube with odd n, the relative positions of the center cubies cannot change. The color of the center facet of one cube face is thus assigned to the whole face, and the cube is considered solved when each facet is correctly positioned on its color’s face. Otherwise, the cube is said to be in a scrambled state.

Rubik’s Cube is commonly known to be almost impossible to solve if no specific solution strategy or algorithm is applied. The closer a cube is to being solved and the more cubies are in the correct position, the more likely it is that any rotation with the intention of solving another part of the cube will scramble already correctly placed cubies. Therefore, precisely considered sequences of rota- tions need to be applied, which ensure that only specific cubies are moved to their intended destinations. Many solution strategies for Rubik’s Cube have been developed. They differ in complexity and speed, depending on the amount of special patterns and conditions that are detected and utilized during the solving process. Generally, the faster a solution algorithm is and the fewer rotations are needed, the more sub-algorithms need to be learned and applied under the correct conditions. The classic beginners’ method is highly inef- ficient but has only few sub-algorithms to be memorized. More advanced methods, such as Fridrich’s CFOP method [Fri97] or the Petrus method, are harder to learn but usually require significantly fewer moves. Generally, solution algorithms often use checkpoints: special points in the state-space of the cube (e. g., having the yellow cross on the yellow side). This state-space, in which the solution algorithms act, is high-dimensional and encompasses more than 4.3×1019 unique states, which makes visualizing the solution path- ways challenging.

In this paper, we present an approach for visualizing solution strategies for Rubik’s Cube by showing how algorithms navigate differently through projections of the high-dimensional state-space. We focus on two solution strategies: a simple method that will be referred to as beginner’s method and the more advanced CFOP method by Jessica Fridrich, hereafter referred to as Fridrich method. We further describe our implementation of a prototype for interac- tively exploring the projected solution pathways, and show how it can be used to answer the following questions:

Q1 Do checkpoints cluster for different initial states?

Q2 When exactly do algorithms start to diverge after starting from the same initial states?

Q3 Are the differences between algorithms immediately recogniz- able?

2. Related Work

Detailed information on a number of different Rubik’s Cube solu- tion algorithms has been compiled in several Wikis and Internet forums [Fer, Mak12]. AlgExplorer [Teo17], published on such an

online forum in 2017, is a command-line tool for exploring the algo- rithm/solution space based on an extensive record of Rubik’s Cube solutions [Jaf]. Scientific papers on Rubik’s Cube have typically been concerned with finding optimal solutions. Kunkle et al., for instance, used out-of-core parallel computing and properties of the cube’s permutation group to find a lower bound of 26 moves [KC07]. However, to our knowledge, no attempts at visualizing different so- lution strategies have been published.

The cube states along the solution pathways can be viewed es- sentially as a multivariate time series, with the cube face colors as categorical variables. Combining dimensionality reduction tech- niques with trajectory encoding is a common choice for visualizing multivariate time series. TimeSeriesPath [BWS∗12], for instance, is based on principal component analysis (PCA). The Time Curves idiom by Bach et al. [BSH∗16] visualizes patterns in temporal data by folding time series into trajectories according to a similarity measure. Schreck et al. used self organizing maps (SOMs) to vi- sualize time-resolved financial data as trajectories [STKF07]. In a similar fashion, textual data has been visualized as projected n- gram series, e. g., by Mao et al. [MDL07]. A generalized version of n-gram trajectories for non-textual data was proposed by Ward and Guo [WG11]. Both of these approaches rely on PCA. Brown et al. used multidimensional scaling (MDS) to visualize system states as trajectories during user interaction [BYC∗18]. In addition to PCA, SOMs, and MDS, also t-distributed stochastic neighbor embedding (t-SNE) [MH08] has proven a powerful tool for creating visualizations of high dimensional sequential data. Van den Elzen et al. applied t-SNE, among other projection techniques, to visualize high-dimensional states of dynamic networks [vdEHBvW16].

For our visualization of Rubik’s Cube solution algorithms, we use a combination of dimensionality reduction, in our case t-SNE, and encoding state sequences as trajectories.

3. Method

Figure 2 shows the workflow for creating the Rubik’s Cube solver visualization. This section describes steps 1 to 5 conceptually, includ- ing cube initialization, data abstraction, projection, visualization, and interaction. Technical details on the implementation are given in Section 4.

3.1. Cube States as Feature Vectors

We create randomly scrambled cubes and automatically apply dif- ferent solution algorithms to them. The first step of visualizing the solution pathways is transforming the cube states into numerical representations for further processing. We based the encoding of the cube state on the data structure underlying the Rubik’s Cube Solver Python API by Lucas Liberacki and Tom Brannan [LB15] (see Section 4 for implementation details). Each face of the cube is represented by a 3×3 matrix with one entry for each facet. For the entries representing the facet colors we chose a one-hot encoding, i. e., (0,0,0,0,0,1) for red, (0,0,0,0,1,0) for green etc. This encoding ensures meaningful distance metrics for the dimensionality reduc- tion. The resulting 6× (3×3)×6 tensor was flattened, yielding a feature vector of length 324 for a single state.

© 2019 The Author(s) Eurographics Proceedings © 2019 The Eurographics Association.

20

C. A. Steinparz, A. P. Hinterreiter, H. Stitz & M. Streit / Visualization of Rubik’s Cube Solution Algorithms

Figure 2: Workflow for the Rubik’s Cube solver visualization.

3.2. Projection

The high-dimensional feature vectors of complete solution pathways are projected to a two-dimens