CSE190L Notes for Monday, 4/7/07

We discussed strategy for the Qubic game. I asked people to think about different kinds of squares in the board. For example, what if you played just 2-dimensional Qubic on a board like this:

             1     2     3     4
          +-----+-----+-----+-----+
        1 |     |     |     |     |
          +-----+-----+-----+-----+
        2 |     |     |     |     |
          +-----+-----+-----+-----+
        3 |     |     |     |     |
          +-----+-----+-----+-----+
        4 |     |     |     |     |
          +-----+-----+-----+-----+
How many different opening moves are there? There are 16 squares you can choose from, but many of them are equivalent. If we ignore rotation and reflection (mirror images), we find three kinds of squares:

I mentioned that there is another transformation of the board to consider. I refer to it as "Lynch transformation", named after a high school friend of mine named Keith Lynch who discovered many interesting properties of the board. Keith isn't the only one to discover this transformation. Oren Patashnik included it in his paper proving that the first player has a guaranteed win.

Under Lynch transformation, you exchange 1's with 2's and 3's with 4's. For example, suppose each player has two pieces on the board:

             1     2     3     4
          +-----+-----+-----+-----+
        1 |  X  |     |     |     |
          +-----+-----+-----+-----+
        2 |     |     |  X  |  O  |
          +-----+-----+-----+-----+
        3 |  O  |     |     |     |
          +-----+-----+-----+-----+
        4 |     |     |     |     |
          +-----+-----+-----+-----+
Under Lynch transformation, the X pieces at (1, 1) and (2, 3) move to (2, 2) and (1, 4) and the O pieces at (2, 4) and (3, 1) move to (1, 3) and (4, 2):

             1     2     3     4
          +-----+-----+-----+-----+
        1 |     |     |  O  |  X  |
          +-----+-----+-----+-----+
        2 |     |  X  |     |     |
          +-----+-----+-----+-----+
        3 |     |     |     |     |
          +-----+-----+-----+-----+
        4 |     |  O  |     |     |
          +-----+-----+-----+-----+
To give evidence that Lynch transformation preserves the board, I reminded people of a strategy I had shown earlier where the X player has 3 corners of a plane and considers a sequence of moves labeled X1, X2, X3, etc., that force the other player to make blocking moves O1, O2, O3, etc:
             1     2     3     4
          +-----+-----+-----+-----+
        1 |  X  |     | X5  |  X  |
          +-----+-----+-----+-----+
        2 |  X1 |  X3 | X2  |  O3 |
          +-----+-----+-----+-----+
        3 |  O1 |  O2 | X4  |     |
          +-----+-----+-----+-----+
        4 |  X  |     |     |  O4 |
          +-----+-----+-----+-----+
After the X5 move, the X player has a double, which guarantees a win on his next move. Under Lynch transformation, this strategy becomes:

             1     2     3     4
          +-----+-----+-----+-----+
        1 |  X3 |  X1 |  O3 |  X2 |
          +-----+-----+-----+-----+
        2 |     |  X  |  X  |  X5 |
          +-----+-----+-----+-----+
        3 |     |  X  |  O4 |     |
          +-----+-----+-----+-----+
        4 |  O2 |  O1 |     |  X4 |
          +-----+-----+-----+-----+
All of the properties of the original configuration are preserved. The Lynch transformation of each X move forces the opponent to block at the Lynch transformation of each original O move. And after the X player moves to X5, he has a double whose two open squares are the Lynch transforms of the original double.

Under Lynch transformation, our original breakdown of the two-dimensional board into three categories reduces to just two categories. The outer corners and the inner squares become interchangeable under Lynch transformation.

When it comes to the three-dimensional board, there would be four categories of squares if you ignore rotation and reflection, but with Lynch transformation, we again end up with just two kinds of squares. One group of squares includes the 8 outer corners and the 8 innermost pieces. Those are the prime real estate of the Qubic board because each of those squares is part of 7 different four-in-a-rows. There are 48 other pieces that are equivalent to each other and they are each in 4 four-in-a-rows. So one thing to keep in mind is that early Qubic play among expert players involves dividing up those 16 prime locations.

I then pointed out some basic concepts of Qubic strategy. Any strategy needs to pay close attention to the 76 four-in-a-rows. These rows can be in one of several different states. Initially all 76 are "open" because neither player has a piece in that row. As the players put pieces on the board, some of these become rows that have just computer pieces and some of them become rows that have just player pieces. We could classify the rows with just computer pieces as being computer1, computer2 and computer3 rows. We could classify the rows with just player pieces as being player1, player2 and player3 rows. Once a row has pieces from both players, it becomes a "mixed" row that is not useful to either player.

I pointed out that this can make for an interesting Qubic view. You could show a list of all open rows, all mixed rows, all player rows and all computer rows. If you had such a list, you'd find that expert players tend to have a longer list than novices. For example, a novice would be more likely to complete a three-in-a-row hoping that the other player won't notice. It's good to do that every once in a while to force the other player to pay attention to that possibility, but it's not something you want to do often because if generally just leads to the loss of a row (it becomes a mixed row when the other player blocks).

I said that an intermediate strategy could be thought of as a max computation:

        max = 0
        for (every open square) {
            if (value(that square) > max) {
                remember that square as the new max.
            }
        }
So the problem of finding a move reduces to the problem of assigning a value to a square. So how do you value a square? You can add up a value for each of the four-in-a-rows that it is part of:

        sum = 0
        for (every row the square is part of) {
            sum += value(that row)
        }
So the problem reduces to finding the value of a particular four-in-a-row. I mentioned to people that a mixed row is probably worth 0 points because it is useless to move into that row. What about a computer2? For a novice, this might seem valuable, but not to a more advanced player. You might use a random number generator to occasionally have a computer2 be valued more highly as a way to keep the human player on his toes. But in general, a computer2 isn't worth much. That is, until you see two of them that both are include the same square. So the first computer2 for a given square isn't worth much, but if you find a second computer2 for a square, then that becomes very valuable because it allows you to complete a double. Similarly, a second player2 would be valuable because it would block a player double.

I mentioned that there is a hierarchy of 4 possibilities that need to have a kind of "veto" power over other possibilities in that if one of these conditions occurs, then it should always be chosen above other possibilities. The hierarchy looks like this:

        if (computer3) {
            always pick this
        } else  if (player3)
            pick this next
        } else if (2nd computer2) {
            pick this next
        } else if (2nd player2) {
            pick this next
        }  else {
            pick something else
        }
So if some square is part of a computer3, then you always want to pick that square. If not, then you'd want to pick any square that is part of a player3. If not, you'd want to pick a square that has two computer2 rows. If not, you'd want to pick a square that has two player2 rows. And if none of those four conditions apply, you can use some other strategy to pick.

Someone mentioned the idea that these conditions could be tested separately, which is true. It is also possible to assign numerical weights to these possibilities that would guarantee that they are always chosen according to this hierarchy.


Stuart Reges
Last modified: Tue May 15 18:54:16 PDT 2007