Explaining Color-Driven Summation

One of my goals with Rubikraze is implementing a function that can solve any Rubik's cube thrown at it using the beginner's level method. In my previous post about Rubikraze I talked about how there are Rubik's cube configurations that are not possible to solve. For example, if you take a completely solved Rubik's cube, and rotate just one piece of it by manually taking it out and putting it back again, you'll end up with something like this:


Assuming that's the only altered piece in the whole cube, we can consider that cube as impossible to solve. There's not a single pattern of movements that could possibly undo those changes without taking that piece out and putting it back again in the right orientation.
With the example above it's pretty obvious that said cube is impossible to solve, but what if you took an unsolvable Rubik's cube, and mixed it? It'll still be unsolvable, and you know that because you knew it was unsolvable from the start, before mixing it. But could you knew if a Rubik's cube is unsolvable just by looking at it?
An unsolvable Rubik's cube could look just like this:


So before ordering my program to solve the Rubik's cube, I need to have it check if the Rubik's cube is solvable at all.

Important Notes: There probably already are ways to know if a cube is solvable at all, but I'm taking this as an opportunity to exercise my problem solving skills. I've not looked at a single guide on the internet to do this, and all this could even be impossible and in vain, but it's worth investigating and trying.
Please take into account that this is a work in progress, I could change some definitions or rules in the future, should I discover that something works differently than I thought before.

Color-Driven Summation

Color-Driven Summation is the name that I've come up with for a process that takes place in every face in the Rubik's cube, that I hope will help me recognize a pattern that could serve as an indicator to accurately determine if a cube is solvable.
Each one of the 6 faces in a Rubik's cube has 9 colored squares in a 3x3 configuration. We assign a number to each of those 9 colored squares in each of the 6 faces; the number can either be +1, +0, or -1; you can also refer as them as positive, neutral, and negative. Then, for each face, we add those numbers up to get a sum for that face. We end up with 6 positive or negative numbers, each representing one of the 6 faces.
But how do we know if a colored square should be positive (+1), neutral (+0), or negative (-1)?
First, we divide the Rubik's cube in 2 groups:
  • The faces White, Red, Blue
  • The faces Yellow, Orange, Green
In each of those 2 groups there are 3 colors. Now, depending on the center color of the face that we are doing the sum for, we assign the 9 numbers.
The center color of the face we are doing the sum for becomes neutral (+0), and so does its opposite. So for example is the center color is white, then every white and yellow square (because yellow is opposite to white in the Rubik's cube) become neutral colors for that face.
Also, one of the colors from the center color group becomes positive, and the other one becomes negative. So, for our example where White is the central color, Blue becomes negative (-1), and Red becomes positive (+1). And for the remaining 2 unassigned colors, we look at its opposites: because the opposite of Green (Blue) is negative, then Green becomes positive; and because the opposite of Orange (Red) is positive, then Orange becomes negative.
Following this idea, we end up with the following table (The symbols <= and => don't mean anything profound, they are just simulating arrows):
-R <=B=> +W
-W <=R=> +B
-B <=W=> +R

+O <=G=> -Y
+Y <=O=> -G
+G <=Y=> -O

If one of the colors in the face are from the other group, we take that color's opposite, and inverse the sign. For example, let's say we are in the Blue face and we encounter a Yellow colored square, what we do is look at Yellow's opposite (White) sign and inverse it; so for Blue, White's sign is positive (+1), so we inverse that, and end with negative (-1).
So when we find a Yellow square in the Blue face, we assign it a negative sign (-1).
But there's actually a kind of faster way to know which sign corresponds to which color. We just take the decision based on the main color's opposite. So with our previous example (Yellow square in Blue face), we take Blue's opposite, which is Green, and look Yellow's sign in Green, which is negative; and we end up with the same answer.
This may look like something not too important but when we code it, we can save ourselves a few instructions, optimizing the program.

I know this explanation might have been a little hard to follow, so I'll just show all of this applied to a real example:


In this example, the center color is Green, so we know this is the Green face. Which means all Green and Blue (because Blue is the opposite of Green) squares will be neutral (+0) in this face and this face only.
Now, we look at each of the colors surrounding the center square:
  1. Blue is Green's opposite, so it's neutral. We assign it +0
  2. Green is the main color, so it's also neutral: +0
  3. Red is not in Green's group table, so we look at Green's opposite, Blue. In Blue's table Red is negative: -1
  4. In Green's group table, Orange is positive: +1
  5. This is always the center color (Green). We don't need to count it since we know it will always be neutral, but let's do it anyways: +0
  6. Orange again: +1
  7. In Green's group table, Yellow is negative: -1
  8. Same operation as with Red. Green's opposite is Blue, and in Blue's group table White is positive: +1
  9. Orange again: +1

The final sum is 0 + 0 - 1 + 1 + 0 + 1 - 1 + 1 + 1 = 2.
So, we can say that Green's face sum is positive 2.

This has been the explanation of the Color-Driven Summation process. This by itself doesn't prove anything, it's just a tool. Recognizing a pattern is a whole different story. But before putting in the effort of finding a pattern with Color-Driven Summation, I first need to be sure that one solvable cube's summation is never the same as one unsolvable cube's summation. More of that in the next post.
As always, thanks for reading.

Comments

Popular posts from this blog

An Audioguide about the Geology of Ecuador

Active Projects as of Today