Tag Archives: GP10

NxN Go

Similar to the last problem from the appendix in that we’re taking an actual game and extending it.

The problem: NxN Go.  This is problem GP10 in the appendix.

The description: Given an integer N, and a position (consisting of black piece locations, white piece locations, and black piece locations) on an NxN go board, and the name of the current player’s turn, does white have a forced win on the game?

Example: Instead of a true example, what I think is most relevant here is a little discussion of the rules and basic strategy of Go.  In Go, players take turns playing stones on a grid, with the goal of surrounding spaces on the board with pieces of your color:

(all pictures are taken from the tutorial at https://www.pandanet.co.jp/English/learning_go/learning_go_2.html):

In this case, white has surrounded 9 spaces (stones are placed at intersections, including the edges of the board).

If a stone of the other color can be surrounded on all 4 sides by a stone of your color, the stone is captured, scoring you a point at the end of the game:

In this case, the black play at “1” captures the white piece (and likely gains black an additional point for having surrounded territory at the end of the game)

More than one piece can be surrounded at a time, but not all configurations of stones can be surrounded.  Most notably, a configuration with two “eyes” (or empty holes)  cannot be captured, for example:

Here, the white play at “1” creates two eyes.  There is no way for black to surround all of the white pieces since they would have to play in both empty holes, and as soon as black plays in one of the holes, the black piece is surrounded and immediately captured.

So, the main goal of Go (and the proof) revolves around creating “safe” structures that contain two eyes and using them to capture as much territory as possible.

Reduction: The paper by Lichtenstein and Sipser reduce from Planar Geography.  The idea is to have a set of safe territory for White, and another threatened set of stones large enough that if it can be made safe, White will win, but if it can be captured, Black will win.  Here’s the picture from the paper:

Black pieces surround white all the way around, so the only escape would be for white to extend the “pipe” on the left around to the safe white spaces (or some other group of two eyes, which will keep the large group alive).  Then we encode the vertices and edges in the graph as sets of stones, where each “choice” of going through an edge is reflected by a choice of where stones are placed.

There are many types of subgraphs and corresponding board positions in the paper, here’s just one of them:

(Graph position)

(Board position)

Here’s the general structure of the arguments that show how the play “has” to go through this vertex.  Suppose we are coming from the top, and white wants to go left.

  • If White doesn’t play at 1, 2, or 3 first, Black will play at 2.  White will now have to play at 1 to keep the middle vertical strip (which connects back to the big threatened set of pieces) alive.  But then Black plays at 3 and takes them all anyway.
  • Even if White plays at 3, Black wins by playing at 1, then White moves to 2, then Black plays at 5
  • If White does play at 1 or 2, (let’s say 1, because that will take us left), Black has to respond at the other point (so, 2 for us).  If they don’t, White plays at 2, and 3 black stones below the 1 and 2 are captured, and White will be able to connect to the two eye group below.
  • After Black plays at 2, white needs to go to 3 to build a line of white stones coming in from the top, and going out to the left.  Black plays at 4 to stop white from connecting to the group of 2 eyes on the left.

As a result, the “edge” going through this vertex and coming out to the left has been chosen.

Difficulty: 7. I think this is easier to see than the NxN checkers reduction, but still takes a lot of cases and structures to realize.

NxN Checkers

Back from my trip with a simple problem to explain, but a hard reduction to do.

The problem: NxN checkers.  This is problem GP10 in the appendix.

The description: Given a position on an NxN checkerboard, does black have a forced win?  It turns out the reduction will also work if we restrict the board to only having kings on the board (and so no “un-kinged” pieces)

Example: The “NxN” requirement is there since on a standard 8×8 checkerboard, there is a finite set of moves, and so theoretically you could solve the problem in O(1) time (for a really large constant factor, of course).  The starting configuration adds extra rows and columns of pieces to the board, still leaving two blank rows in between the two pieces.

So, let’s do an example on a 4×4 board.  The starting configuration is this:

* *
O O

(the dashes are empty spaces, * is Black, O is White)

Here is a configuration of pieces that will lead to a black win:

*
O
*

If it’s Black’s turn, they should move the piece in the second row up to either location on the first row (recall that all pieces are kings).  Then White’s only move is to go to the space Black just vacated, where it will be jumped, giving Black the win.

Reduction:

The paper by Fraenkel, Garey, Johnson, Schaefer, and Yesha contains a pretty detailed description of the reduction, which contains lots of complicated structures.  I’ll just give the general idea here.

The reduction is going to be from Geography, which is still NP-Complete even if the graph is bipartite and planar.  They create several structures to help them build their instance of the checkers game.

The first is what the call a phalanx– an open rectangle of (say) White kings that surround the (say) Black pieces.  The idea is that since there is no way for the Black pieces to jump anything in the rectangle, then White can “shrink” the phalanx towards Black, running them out of room to maneuver.  Here is a picture of a small phalanx on a 6×6 board:

O O O
O O O
O X O
O O
O O
O O O

..notice that whatever Black does, they will be captured on their next turn.  This remains true no matter how many Black pieces are trapped inside the phalanx, and no matter how much open space is inside the phalanx (White can use their moves to shrink it over time).

The key to the reduction is to build a set of interlocking “potential” phalanxes- situations where a Black king may be able to escape the phalanx.  If it can, Black can jump White’s pieces and win, but if it can’t, the phalanx will engulf Black and they will lose.  The geography instance is placed in the center of these potential phalanxes in such a way that a Black king can “escape” the Geography instance if and only if Black can win the geography game.  The reason why the Geography graph had to be planar was so that we could directly represent the vertices in the graph as positions on the checkerboard.  The reason why the Geography graph had to be bipartite was so that edges going from the first vertex set to the second could be all Black pieces, but the edges going from the second set to the first could be all White pieces.

The game starts with black at the “start vertex” for the geography problem, and jumping a line of White checkers:

When a vertex has more than one possible exit, that leads to more than one possible set of checkers to jump for the other player:

(This is part of figure 10 from the paper.  Here, after White jumps down the chain of Black pieces, Black can choose the chain of White pieces to jump through.)

The construction takes advantage of the rule in checkers (which I was not aware of until I was in my twenties!) that if a player can make a jump, they must make a jump.  So as long as players can jump checkers along these chains (alternately, as long as they can follow edges in the geography graph), they will.  As soon as a player cannot make a jump they will be able to deal with the Black king that can either escape the phalanx structure (and win for Black) or trap it (and win for White).

This is the general idea of the reduction, there are a lot of details that I am glossing over.

Difficulty: 8.  This is a bit hard to see and very hard to come up with, and it’s very easy to get lost in the weeds of the details.  I do like the way that the “removal” of edges from the Geography problem is modeled by the actual removal of pieces from the checkerboard, though.