Tag Archives: Difficulty 8

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.

Sift

Finally, we’re ready to go back to the problem in the appendix.

The problem: Sift.  This is problem GP6 in the appendix.

The description: Suppose we have some set X, with collections of subsets of X A and B.  The sets A and B have no elements in common.  Players take turns choosing elements from X until every subset in A (in which case player 2 wins) or every subset in B has a chosen element (in which case player 1 wins).

We do need to have a rule for what happens if an element is chosen that makes both players lose (because the element chosen intersects with the last subsets in both A and B).  In this case, the player who made the move loses.

Example: Suppose X was {1,2,3,4,5,6}.  A = {{1,2}, {3,4}, {5,6}} and B = {{1,2,3}, {4,5,6}}.  Then A could force a win by choosing element 3.  This intersects the second set in A, and the second set in B.  So the current “live” subsets are:

A = {{1,2}, {5,6}}

B = {{1,2,3}}

Player B needs to pick 5 or 6, or they immediately lose.  But once that happens, player A can choose 3, which means the set of elements chosen {3,4,5} (or {3,4,6}) intersects with every set in B, but not every set in A, so A wins.

Reduction: The Shaefer paper reduces from Avoidance Truth Assignment, which means we start with a CNF formula with no negated literals.  Let’s assume the formula has m clauses and n variables.  For each clause k define the set Sk to be the indices of the variables in clause k.   (So if clause 1 was: x∨ x4 ∨ x7, then S1 = {2,4,7}).  Let “Set 1” = all of the Sk sets of even length, and “Set 2” = all of the Sk sets of odd length.  If n is even, give player 1 “Set 1” and player 2 “Set 2”.  If n is odd, reverse the allocation.

Notice that “Set 1” is the set of all clauses with an even number of distinct variables in them, and “Set 2” is the set of all clauses with an odd number of distinct variables in them.  Recall from our discussion of the Avoidance Truth Assignment problem that the player whose turn it was could win that game if we had an even number of unplayed variables, and an odd number of unplayed variables in every clause  (or an odd number of unplayed variables, with an even number in every clause).  What our “Set 1” and “Set 2” constructions are doing is listing out those clauses and assigning them to each player.  Once one set runs out, then we have the winning case for one of the 2 players.  So this construction of Sift is equivalent to the original Avoidance problem.

Difficulty: 8.  I wish there was a good proof of this odd/even claim he makes.  I don’t 100% buy his intuitive argument.

Avoidance Truth Assignment

This is the second of the two proofs in Schaefer’s paper that will get us the Sift reduction.

The problem: Avoidance Truth Assignment.  (My name for it).  This problem does not appear in the G&J appendix.  It is named “Gavoid (POS CNF)” in Schaefer’s paper.

The description: Given a CNF formula with no negated literals (and not necessarily 3 literals per clause), players take turns choosing a variable to make true.  A player loses if after their play the formula becomes true, even if all unchosen variables are set to false.  Does player 1 have a forced win?

Example: Suppose the formula was (x1 ∨ x2) ∧ (x1 ∨ x3) ∧ (x2 ∨ x3 ∨ x4).  Then player 1 could force a win by choosing x2, which makes clauses 1 and 3 true.  The player who chooses x3 will lose, so player 2 should pick one of x2 or x4.  But then player 1 chooses the other, leaving player 2 forced to pick x3, making the second clause (and the whole formula) true.

Reduction: Schaefer reduces from Pre-Partitioned Truth Assignment.  So we start with a logical formula given as a set of clauses, and the variables are partitioned into two sets, one for each player.  We’ll call player 1’s variables x1 .. xn and player 2’s variables y1 through yn.   We’ll assume (or modify the formula to make it happen) that each clause contains at least one x variable, and that every variable occurs both positively and negatively as a literal someplace in the formula.

Our new formula will have:

  • 4 copies of each variable (xi turns into xi, ~xi, xi‘, and ~xi
  • One clause (xi ∨ ~xi) for each x variable
  • One clause (yi ∨ ~yi ∨ yi‘) for each y variable
  • For each clause in the original formula: if it contains an unnegated variable xi (or yi), then our new clause will contain xi and xi‘.  (Or yi and yi‘).  If it contains a negated literal, we’ll use the 2 “negated” variables instead.  This clause will probably have more than 3 elements in it, but that’s ok.

Shaefer notes that if we hit a point in the game where we have:

  1. An even number of unplayed variables, and
  2. An odd number of unplayed distinct variables remaining in every clause.

or:

  1. An odd number of unplayed variables, and
  2. An even number of unplayed distinct variables remaining in every clause

..then the player who’s turn it is can win by picking some unsatisfied clause and picking any variable that does not satisfy it.  So the strategy for the first player is to create the first situation (by satisfying all clauses with an even number of variables), and the strategy for the second player is to create the second situation (by satisfying all clauses with an odd number of variables).  Since the first kind of clause we made (with the x variables) has an even number of variables, player 1 will want to satisfy those clauses as fast as possible.  Similarly, since the second kind of clause we made (with the y variables) has an odd number of variables, palyer 2 will want to satisfy those clauses as quickly as possible.  If this happens, we are exactly imitating the Pre-Partitioned Truth Assignment game.

The remainder of the reduction is a detailed proof explaining the above argument in detail (showing, for example, what happens when players do not play this way).

Difficulty: 8  Maybe they’re getting a little easier for me because I’ve been doing so much of them.  Or maybe because I’m still skipping all of the low-level details.

Protected: Generalized Hex

This content is password protected. To view it please enter your password below:

Protected: Equilibrium Point

This content is password protected. To view it please enter your password below:

Protected: Permanent Evaluation

This content is password protected. To view it please enter your password below:

Protected: Cosine Product Integration

This content is password protected. To view it please enter your password below:

Protected: Periodic Solution Recurrence Relation

This content is password protected. To view it please enter your password below:

Protected: Number of Roots for a Product Polynomial

This content is password protected. To view it please enter your password below:

Protected: Root of Modulus 1

This content is password protected. To view it please enter your password below: