Abstract
When solving k-in-a-Row games, the Hales–Jewett pairing strategy [Trans. Amer. Math. Soc.
In this paper we present a new strategy, called Set Matching.1
This work is an extension of research presented at the ACG 2017 conference, which was published [in: Advances in Computer Games: 15th International Conference, ACG 2017, Springer, 2017, pp. 38–50].
We show several efficient configurations with their matching sets. These include Cycle Configurations, BiCycle Configurations, and PolyCycle Configurations involving more than two cycles. Depending on configuration, the coverage ratio can be reduced to as low as 1.14.
Many examples in the domain of solving k-in-a-Row games are given, including the direct proof (not based on search) that the empty
To illustrate the power of the method we also show two applications, which prove that 9-in-a-Row and 8-in-a-Row on infinite boards (and hence on any finite board as well) are draws, in a much more rigid way than by case analysis.
Introduction
Playing k-in-a-Row games is a popular pastime activity (Gardner, 1983). They are played by two players alternately claiming a square, trying to form k consecutive squares of their color in a straight line on some rectangular
The
In this paper we present results of a study to transform the pairing strategy into a method where a set of groups can be proven to be at most a draw using less than two empty squares per group. We denote this strategy as Set Matching. In Section 2 we give some background theory. Then three classes of matching sets using one, two, and more cycles are presented in Sections 3–5. The configurations are exemplified by positions from 4-in-a-Row games. In Section 6 we provide an overview of the configurations and their efficiencies, and give some experimental results. Two more elaborate applications are given in Section 7. Here we show proofs based on matching sets that 9-in-a-Row and 8-in-a-Row on arbitrary boards are game-theoretical draws. Conclusions and an outlook to future research are given in Section 8.
Background
We first give a theoretical framework for A (Taken from Beck (2005; 2008), Hefetz et al. (2014)).
Groups can interact in several ways. We formalize this as depending on the number of common nodes that pairs of groups can have. Two groups without common nodes are called A
As an easy example we consider the 555-game. In the initial position (the empty
In this figure every group is covered by a pair of nodes marked by a symbol indicating the direction of the group. Using the HJ-pairing strategy White now can always occupy at least one square of every group, thereby preventing Black from occupying a complete group. Since Black thus cannot win the 555-game, the game-theoretical result is a draw. The A

A HJ-pairing for the 555-game.
By its definition a matching set is a generalization of a HJ-pairing, where each covering directly or indirectly terminates in one or more HJ-pairings. The coverage ratio of a matching set
When showing matching sets we will use the following conventions in the remainder of this paper. 1) Common abbreviations will be used, like a–h for the markers a to h. 2) Every group is denoted by all the markers in the group, where for brevity reasons we omit parentheses and commas. For instance, the group containing markers a and b is denoted by just
In this section we give several configurations that need less than 2 markers per group. For each such configuration we give a sketch and a diagram of an example board position taken from a 4-in-a-Row game. We always assume that the positions are with Black as first player to move and that White as second player shows that Black cannot win the position. The example positions are chosen such that no other groups without white stones are present (where Black could possibly win) except those in the matching set, that all non-marker squares in the groups are occupied by Black (to prevent simple HJ-pairings), that there are as many white as black stones (i.e., legal positions), and that there are no black threats outside the groups (so White needs only address the local situation). Note that we ignore possible wins for White in a specific example position, since we only are showing that the position is at least a draw for White.
When referring to specific squares in a position we will use chess-like notation, where columns are labelled from left to right by ‘a’, ‘b’, etc, and rows from bottom to top by ‘1’, ‘2’, etc. Further we denote squares that are unoccupied, occupied by a black stone, or occupied by a white stone simply as empty, black, or white squares, respectively.
The Triangle Configuration
To achieve a reduction of the number of markers needed, we investigated the idea that the groups intersect in a cyclic way. The smallest such set of groups is when three groups are involved. The Triangle Configuration is formed by three pair-wise intersecting groups. All three intersections are markers. Further two of the three groups have one additional (edge) marker. See Fig. 2 (left) for a sketch. Markers are required to be unoccupied. Non-marker nodes can be unoccupied or black.
In this configuration White always responds with a or b after any black marker move. We denote a and b as the main markers, i.e., the set of white follow-ups to Black’s initial play. By doing this, two of the three groups will be covered and the third group then can be covered by two unused markers in that group using a naive HJ-pairing. The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the Triangle Configuration.
The diagram in Fig. 2 shows an example position. Black has only three groups left (indicated by the dashed lines). A naive HJ-pairing fails. However, recognizing that this position contains a Triangle Configuration (for instance with a, b, c, d, and e corresponding to a1, a4, d1, c1, and c2), we see that these five squares form a matching set for these three groups, proving that this position is (at most) a draw for Black.
We can easily define a similar configuration using a Square, with one side having two marker nodes (the main markers), the other three sides with three markers, see Fig. 3.
This covering is rather similar to the Triangle Configuration, just prolonging the naive HJ-pairing for one more group along the cycle after Black’s first move and White’s response to that. Therefore, the formal notation for a matching set of this configuration is:

Sketch and example position illustrating the Square Configuration.
Closer examination shows that we can generalize this to any cycle of size n (
Set matching using BiCycle configurations
The single-cycle configurations in Section 3 just give a reduction of 1 node per independent cycle. It therefore would be advantageous when multiple cycles interact in such a way that they can be used in a more efficient matching set. For this we need overlapping node sets and possibly group sets overlapping as well. We need at least two common nodes in the node sets, since otherwise Black can start with the single common node, after which we have two disjoint group fragments without any reduction at all.
In this section we will investigate configurations consisting of two interacting triangles, starting with one triangle and reusing up to two sides for a second triangle. When the two triangles have three common sides, they necessarily coincide, and no gain can be obtained. In the next subsections we therefore consider the following 3 cases: 1) two triangles with two common sides; 2) two triangles with one common side; and 3) two triangles without common sides.
Configurations of two triangles with two common sides
When the two triangles have two common sides, we have several possibilities for the non-common side of the second triangle. We just give one case, namely where this side uses the two edge markers of the first triangle. Since this configuration can be equally well seen as a triangle with an intersecting line, we denote this configuration as a Triangle/Line Configuration, see Fig. 4. The thick dashed lines denote the common sides of the triangles.
In this configuration, the main markers are a and b, like in the simple Triangle Configuration with triangle

Sketch and example position illustrating a Triangle/Line Configuration.
The idea of two cycles with one new side also works with other cycles. We just give one example, see Fig. 5.
Here we have two overlapping squares with three common sides (a Square/Line Configuration), where the not-common side of the second square using one additional marker intersects the first square in two edge markers. The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the Square/Line Configuration.
Of course we again can generalize this to two cycles of any size n (
When the two triangles have one side in common, the common side should be the side with just two markers of the first triangle. If not, Black could choose one of the main markers such that White has to respond outside the second triangle, which does not give a useful situation. When the two triangles share this side, we have two subcases. The first is when no other nodes are shared, leading to a BiTriangle Configuration, see Fig. 6. Responses by White in these two cycles are related by mirror symmetry.
The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the BiTriangle Configuration.
Note that several independent configurations may be used simultaneously. As a notorious example, consider the empty
Since these two matching sets do not interact (their node sets are disjoint), we may combine the two configurations for the empty

Example positions illustrating two BiTriangle Configurations (left and middle) and their combination (right) on the empty
As the second subcase we consider the possibility that the two triangles also share another edge marker, see Fig. 8. We denote this configuration as the BiTriangleX Configuration.
The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the BiTriangleX Configuration.
Another idea is to use the triangles without reduction, but sharing common markers. There are many ways to do this. We just give one useful case, see Fig. 9. We call this configuration the FlatStar Configuration.
In this configuration the marker set consists of the eight nodes a–h. It is easy to verify that after every first black move on a marker, White has a suitable response by b or g (the two main markers), leaving a situation were all remaining groups can be covered with a naive HJ-pairing. As a result the markers a–h covers all 6 groups. The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the FlatStar Configuration.
When more than two cycles are involved (further denoted as PolyCycles), the number of possible cases grows considerably. We just give two possibilities. The first possibility is to form an additional cycle using all-but-one common sides with one cycle, leading to PolyCycle/Line Configurations, see Section 5.1. The second possibility is when more than two cycles share one common edge, see Section 5.2.
PolyCycle/Line Configurations
If the configuration permits it may be possible to combine PolyCycles with Lines. Again, there are many ways to do this. A first possibility is shown using a BiTriangle. From Fig. 6 and the accompanying matching set we see that in all move sequences in this configuration node d or e and node g or h are not used. This gives the opportunity for adding one more group through for instance d and e with one additional edge marker. This leads to the BiTriangle/Line Configuration, see Fig. 10.
The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the BiTriangle/Line Configuration.
We may even add a second group, through g and h with one additional edge marker. This leads to the BiTriangle/BiLine Configuration, see Fig. 11.
The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the BiTriangle/BiLine Configuration.
Also the BiTriangleX Configuration of Fig. 8 lends itself for adding an additional group. Since in the matching set either node d or g need not be used, adding an additional group through d and g with one additional edge marker leads to a BiTriangleX/Line Configuration, see Fig. 12. Note that marker e need not be on the group through d and h (althoug it might be), which is the reason why markers d and g are shifted to the right compared with Fig. 8.
The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the BiTriangleX/Line Configuration.
A last useful line configuration is the FlatStar/Line Configuration, were we have connected the two main markers b and g in Fig. 9 (left) with an additional group. Since White always plays b or g, we even do not need an additional marker for this group. A sketch is given in Fig. 13.
The formal notation of a matching set of this configuration is:

Sketch and example position illustrating the FlatStar/Line Configuration.
It is possible to include more than two cycles in a configuration with all cycles having one common side. One such example with three triangles with one common side combines the BiTriangle and BiTriangleX Configurations, and is denoted as a TriTriangleX Configuration. A sketch is given in Fig. 14.
The formal notation for a matching set of this configuration is:

Sketch and example position illustrating the TriTriangleX Configuration.
In theory the TriTriangleX configuration permits the combination with a Line through nodes i and j with one additional edge marker, leading to a TriTriangleX/Line Configuration, which is a possible configuration on arbitrary graphs. However, due to the nature of
In Table 1 we show the requirements and reductions for all configurations given in Sections 3–5. Moreover, we give the results of a small experiment on the example positions. Note that all example positions occur in the search tree investigated when solving the game associated with the given position (i.e., the empty board for that position).
The first column gives the configuration, the next two columns the number of markers required and the number of groups covered. Next, the reductions in nodes required compared to HJ-pairings are given and the coverage ratios (number of markers / number of groups). In the last two columns we give the example positions used and the number of nodes that our 4-in-a-Row program (Uiterwijk, 2018) needs to prove them to be draws, using naive HJ-pairings.
Some drawing configurations
Some drawing configurations
We see that all configurations need less than 2 markers per group, with 1 marker reduction for the simplest configurations up to even 6 for the FlatStar/Line Configuration. Most informative for the efficiency of the Set Matching method are the coverage ratios of the configurations, always being smaller than 2.0 (the coverage ratio of a HJ-pairing for an arbitrary number of groups), and improving up to 1.14 for the FlatStar/Line Configuration.
The small experiment conducted gives a rough indication of the performance improvement that might be expected in a “real” application (solving the games), where every occurrence of a configuration shown reduces the number of positions investigated by the number in the rightmost column minus 1 (needing no further search). Of course the overall performance improvement depends on the frequencies of the occurrences of these configurations during solving the games. This will be subject of future research.
To illustrate the applicability of Set Matching further we provide two examples showing how Set Matching can give much more rigid proofs in some applications.
9-in-a-Row is a draw
A first proof that 9-in-a-Row is a draw on an infinite board was given already in 1954 by Pollak and Shannon.2
This proof is mentioned at several places, such as Berlekamp et al. (1982), Beck (2008), though no direct reference is found.
In this configuration, we have a triangle

H-heptomino with winning sets and sketch of the matching set.
The sketch in Fig. 15 illustrates that this matching set covers four of the five groups of size 3 in an H-shaped heptomino (the two diagonal groups, the horizontal one and the rightmost vertical one). Pollak and Shannon showed that if we cover the infinite plane with an H-heptomino tiling (see Fig. 16), and White uses this blocking strategy in each H-heptomino in which Black plays, then the strategy guarantees that Black will not be able to claim any straight line larger than 8 squares, showing that 9-in-a-Row is a draw on the infinite board. The markers and dashed lines in Fig. 16 denote maximal-length lines that Black can achieve in each of the four directions when White uses this drawing strategy. Since White’s strategy only involves blocking black groups, the same strategy can also be used to prevent black lines longer than 8 squares on a finite board (if the strategy demands White to play outside the board, he just makes an arbitrary move). Hence 9-in-a-Row is a draw on any board.

A tiling of the plane with H-shaped heptominoes with maximum-length black lines in all four directions.
We note that when Hales and Jewett published their paper explaining the pairing strategy (Hales and Jewett, 1963), they also gave a pairing strategy on the infinite board proving that 9-in-a-Row on the infinite board (and hence on any finite board) is a draw, see Fig. 17.3
The literature is vague on this fact as well. Whereas it was mentioned at several places like Berlekamp et al. (1982), Beck (2005; 2008) that this pairing strategy was due to Hales and Jewett, it is not in their 1963 (Hales and Jewett, 1963) paper nor in any other source we have found.
According to the characterisations in Győrffy et al. (2016; 2017) this pairing can be denoted as an optimal and good pairing for 9-in-a-Row. A pairing is good if it is successful, i.e., it guarantees the second player at least a draw. A pairing is optimal for k-in-a-Row if 1) every pair blocks exactly

The Hales–Jewett pairing on an infinite board proving that 9-in-a-Row is a draw.
Although at first sight it seems challenging to find a Hales–Jewett type of pairing for 8-in-a-Row on the infinite plane also, it was shown a few years ago that no such pairing exists. First, Kruczek and Sundberg (2008) proved that for a k-in-a-Row game a pairing strategy exists when
Of course the above argument only shows that there is no pairing strategy proving that 8-in-a-Row is a draw, but not that there cannot be another blocking strategy to guarantee a draw. Indeed, a first proof that 8-in-a-Row is a draw on an infinite board was given by Zetters (Guy et al., 1980). This proof also involves tiling the infinite board. The tile used (the Zetters’ block) was a “ragged” piece of 12 squares (3 times 4). The Zetters’ block is given in Fig. 18 (left). It can be shown that Black cannot fully claim one of the three horizontal lines of length 4, nor one of the four diagonal lines of length 3, nor one of the two vertical lines of length 2. These groups are the winning sets in the Zetters’ block. Note that all nodes are member of 2 groups, except the nodes on the two vertical lines (b, e, h, and k), being member of 3 groups.
The proof that Black is unable to claim any of the indicated groups fully was also by search (though not a trivial case analysis). As an alternative proof we here provide a matching set doing the job, according to the sketch in Fig. 18 (right).

The Zetters’ block with winning sets and sketch of the matching set.
We see that the matching set M is defined recursively, but always terminates with simple HJ-pairings. In this example we need a two-level deep recursion. As a result, this configuration of 9 groups is covered with just 12 markers, a reduction of 6 nodes.
The proof that 8-in-a-Row is a draw is done by tiling the infinite plane with Zetters’ blocks, see Fig. 19. The markers and dashed lines denote maximal-length lines that Black can achieve in each direction when White uses this drawing strategy. From this figure it is immediately evident that Black will never get a horizontal or vertical line with more than 6 black stones in a row, nor a diagonal line with more than 7 black stones in a row, hence 8-in-a-Row is a draw on the infinite board and hence on any finite board as well.

A tiling of the plane with Zetters’ blocks with maximum-length black lines in all four directions.
In this paper we have presented an enhancement of the Hales–Jewett pairing strategy, called Set Matching. This strategy needs less than 2 squares per group. We have given several configurations with their matching sets, including Cycle, BiCycle, and PolyCycle Configurations. Depending on the configuration, the coverage ratio is reduced to as low as 1.14, compared to 2.0 for HJ-pairings.
Many example positions for 4-in-a-Row games are given, including the direct proof (without further search) that the
As future research we first will fully implement Set Matching in our k-in-a-Row solver (Uiterwijk, 2018) to investigate its effectiveness compared to naive HJ-pairings for solving games. Some related work has been done by Kutz (2005). He shows based on graph decomposition how to find optimal strategies in polynomial time for deciding if the second player can prevent the first player from winning, but this is strictly done for the class of almost-disjoint (edge intersections in at most one node) graphs of rank three (groups with at most three nodes). For more complicated situations like our
Secondly, we will further look for other interesting configurations, a main challenge for non-overlapping groups being one with a matching set (N, G, C) with
Thirdly, we will investigate how well Set Matching will perform in case of overlapping groups. Already for standard HJ-pairings we face the difficulty that marker pairs can cover multiple groups simultaneously, but it is no sinecure to find the best marker pair to cover overlapping groups. Using Set Matching this problem will even become more difficult.
