The Set of Virtual Connections in the Game of Hex is PSPACE-Complete - - PDF document

the set of virtual connections in the game of hex is
SMART_READER_LITE
LIVE PREVIEW

The Set of Virtual Connections in the Game of Hex is PSPACE-Complete - - PDF document

The Set of Virtual Connections in the Game of Hex is PSPACE-Complete Stefan Kiefer August 1, 2003 Abstract It is argued in a semi-formal way that the set of virtual connections in hex games is PSPACE-complete. A conclusion is that an


slide-1
SLIDE 1

The Set of Virtual Connections in the Game of Hex is PSPACE-Complete

Stefan Kiefer August 1, 2003

Abstract

It is argued in a semi-formal way that the set of virtual connections in hex games is PSPACE-complete. A conclusion is that an exhaustive search for virtual connections in a concrete game situation is (in general) not feasible in polynomial time. This explains theoretically the necessity of heuristics in Hex playing programs that search for virtual connections. This paper is a short version of a comprehensive theoretical analysis of virtual connections which I made as a part of my studies at Stuttgart University (Germany) with the advice of Prof. Dr. Ulrich Hertrampf.

Contents

1 Introduction and outline of the problem 2 2 The restricted role of the AND rule 3 3 The strategy for realizing virtual connections 4 4 The PSPACE-hardness 7 5 Conclusions 8

slide-2
SLIDE 2

1 INTRODUCTION AND OUTLINE OF THE PROBLEM 2

1 Introduction and outline of the problem

The game of Hex is a board game which has very simple rules but requires sharp tactical and strategic skills if played on a high level. For the rules and the history of the game, see [Ans02].

  • V. V. Anshelevich is the inventor of the concept of virtual connections in

Hex games [Ans02]: If a player can force a connection of two cells x and y in the future play even if the opponent moves first, then this player has by definition a (general) virtual connection of x and y. Anshelevich defines in [Ans02] a set of deduction rules (AND deduction rule, OR deduction rule) which can be used to build complex virtual connections starting from the simplest ones, namely the pairs of neighboring cells. This process of building virtual connections is called H-search and defines the set

  • f virtual connections in the stricter sense. This set is a proper subset of the

set of (general) virtual connections defined above. In this paper by “virtual connections” we mean the virtual connections in the stricter sense. Anshelevich gives in [Ans02] a straight-forward algorithm performing such an H-search. Unfortunately, no general runtime analysis is given in [Ans02].1 However, it is remarked in [Ans02] that in practice heuristics have to be applied to H-search “due to limited computing resources”. In this paper we show that virtual connections are PSPACE-complete. We therefore draw the conclusion that it is highly unlikely – to the best of today’s complexity theory knowledge – that there exists any polynomial time algorithm performing exhaustive H-search. But nevertheless, virtual connections have been proven to be useful in Hex playing programs. Anshelevich himself wrote a superior program, called Hexy, which spends a lot of time calculating virtual connections. If two cells x and y represent the borders belonging to a player and if x and y are virtually connected then this player has a winning strategy. But virtual connections seem to be useful even if x and y do not represent the borders but normal cells. The presence or absence of a virtual connection gives deeper insight into the strategic and tactic situation of a game which then can be utilized for a better evaluation of the position. A better evaluation function, in turn, improves a standard α-β-search [Ans02].

1Anshelevich gives a runtime analysis for two special classes of Hex graphs which results

in polynomial time concerning these classes.

slide-3
SLIDE 3

2 THE RESTRICTED ROLE OF THE AND RULE 3 Because the practical value of virtual connections is proven by the superi-

  • rity of the program Hexy, the complexity of their calculation is of great

practical interest. For a definition of the AND/OR deduction rules we refer to [Ans02]. In that article it is also argued that the set of virtual connections in the stricter sense is a proper subset of the set of general virtual connections (“incompleteness

  • f the AND/OR deduction rules”). If these sets were equal (but they are

not), then it would be obvious that the problem of finding virtual connections cannot be easier than determining the game-theoretical winner of a given Hex position. The latter is PSPACE-complete [Rei81].

2 The restricted role of the AND rule

The goal of this section is to argue that the AND rule can in some cases be omitted without restricting the set of recognizable virtual connections. Keep in mind that the AND rule for virtual semi-connections is the only way to build virtual semi-connections and therefore cannot be omitted. But the part of the AND rule that builds a virtual connection from two smaller virtual connections can in most cases be replaced by instances of the OR rule. A crucial point is the representation of Hex positions in a computer. For calculating virtual connections it is reasonable to model a Hex situation from

  • ne player’s point of view. One can model Hex positions as Hex graphs as

shown in [Ans02]. Neighboring cells that are both occupied by the player can be regarded as one single cell (sometimes called a group). Cells occupied by the opponent are not represented. Thus, Hex positions are graphs whose nodes are either marked as free or occupied and whose neighboring nodes are not both marked as occupied. This is roughly the representation which is (probably) used by the Hexy

  • program. One could think of a slight change of the representation: For all
  • ccupied cells we add edges between all the neighbours of the occupied cell.

This corresponds to an application of the AND rule in the first generation. It can be shown by induction over the generation of virtual connections that any virtual connection can now be deduced by only applying the OR rule for virtual connections and the AND rule for virtual semi-connections. The occupied cells could therefore be removed. If one is interested, however, in a virtual connection whose end is an occupied cell, one should, of course,

slide-4
SLIDE 4

3 THE STRATEGY FOR REALIZING VIRTUAL CONNECTIONS 4 not remove this cell. But also in this case the application of the AND rule can be restricted as described. We do not propose to omit the AND rule in practice. Consider, for example, the graph in figure 1.

x y

Figure 1: A chain of two-bridges The cells x and y are virtually connected which can be proven with the AND- rule in an obvious way. The maximal number of virtual semi-connections

  • n the input side of the OR rule is two.

If we deleted the two middle

  • ccupied cells while adding edges between their neighbors we could build

the virtual connection between x and y without applying the AND rule for virtual connections. But we would need six virtual semi-connections on the input side of the last application of the OR rule (one for every empty cell). One heuristic is to restrict the number of virtual semi-connections on the input side of the OR rule. But it seems that one has to pay for the omission

  • f the AND rule by large input sides of the OR rule.

If one keeps the “restricted-OR-input” heuristic, severe “blind spots” are probably created. The possibility of omitting the AND rule makes a theoretical analysis eas-

  • ier. Furthermore it can deepen the understanding of which kinds of general

virtual connections are recognized by H-search and which kinds are not. In the next section we show, using the result of this section, how the strategy for realizing virtual connections can be described.

3 The strategy for realizing virtual connections

With the result of the previous section, we can restrict to Hex graphs with-

  • ut any occupied cells.2 We only apply the AND rule for the building of

virtual semi-connections from virtual connections and the OR rule for the building of virtual connections from virtual semi-connections. This leads to the following informal description of a strategy.

2Some readers might find it easier to assume the ends of a virtual connection to be

  • ccupied.
slide-5
SLIDE 5

3 THE STRATEGY FOR REALIZING VIRTUAL CONNECTIONS 5 Assume, a player (“our player”) has a virtual connection between two cells x and y and the opponent moves first. Our player decides to realize the virtual connection between x and y and announces that he will build a single chain between x and y and that all of his own moves are a part of this chain. Furthermore he announces the set of the fields that he will possibly occupy, the carrier C. Then the opponent occupies some cell. The first move of our player is the

  • ccupation of a cell z. According to his announcement, he will connect x

with z and z with y. He can now furthermore announce the disjoint carriers A, B ⊆ C that he might need for these connections. Then again, the opponent occupies some cell. Our player occupies a cell z′ which he either announces to connect with x and z or announces to connect with z and y. In both cases he also announces the carriers. The game is played in this way until our player has completed his chain. Whenever he occupies a cell his chain gets more concrete. Figure 2 shows an illustration of this strategy. We call such strategies direct-connecting strategies.

x y z z′

Figure 2: The strategy for realizing a virtual connection It is quite clear that whenever a player has a virtual connection between x and y he also has a x-y-direct-connecting strategy. The opposite direction is true as well and we will use it in the next section, but we don’t prove it here.

slide-6
SLIDE 6

3 THE STRATEGY FOR REALIZING VIRTUAL CONNECTIONS 6 These considerations lead to the nondeterministic algorithm 3.1 which checks if two cells x, y are virtually connected. It is a PSPACE algorithm and could be made deterministic with Savitch’s theorem preserving its polyno- mial space. Algorithm 3.1 check-virt-conn function check-virt-conn(V, x, C, y) return boolean (∗ V is the set of cells. ∗) (∗ It is returned, whether there is a virtual connection ∗) (∗ between x and y with carrier C′ ⊆ C. ∗) var n, i: {1, . . . , |V |} c: array of V C1, C2: array of 2V begin if {x, y} ∩ C = ∅ then return false elsif {x, y} ∈ E then return true endif guess n, c1, . . . , cn, C1

1, . . . , C1 n, C2 1, . . . , C2 n such that

n

i=1

  • {ci} ∪ C1

i ∪ C2 i

  • ⊆ C

n

i=1

  • {ci} ∪ C1

i ∪ C2 i

  • = ∅

∀i ∈ {1, . . . , n} : ci ∈ C1

i ∪ C2 i

∀i ∈ {1, . . . , n} : C1

i ∩ C2 i = ∅

else return false endguess for i := 1 to n do if not check-virt-conn(V, x, C1

i , ci)

  • r not check-virt-conn(V, ci, C2

i , y)

then return false endif endfor return true end

slide-7
SLIDE 7

4 THE PSPACE-HARDNESS 7

4 The PSPACE-hardness

In [Rei81] the PSPACE-hardness of the game of Hex is shown by reducing the best-known PSPACE-complete problem, the QBF problem, to Hex. I. e., Reisch, the author of [Rei81], gives a mapping that maps true formulas on winning Hex graphs and false formulas on losing Hex graphs (from one player’s point of view). Furthermore, Reisch shows that the resulting Hex graphs can be embedded in real Hex boards. Our argument for the PSPACE-hardness of virtual connections is now quite simple: We only slightly modify Reisch’s construction and show that true formulas are, in fact, mapped on winning Hex situations, whose “winning property” can be proven by a virtual connection of the borders. False for- mulas are mapped on losing Hex situations; therefore it is not possible that the borders are virtually connected.

s t h graph from [Rei81]

Figure 3: Slight modification of the construktion from [Rei81] The modification of Reisch’s construction (figure 3) is only necessary in

  • rder to give the opponent the first turn. It does not touch the fact that

the resulting graph can be embedded in a Hex board. In order to argue why true formulas are mapped on positions with virtually connected borders, one can show that the winning player can pursue a direct- connecting strategy. We won’t do this in detail here (it requires a detailed inspection of Reisch’s non-trivial construction), but we remark that the winning strategy consists

  • f two phases:
  • 1. In the first phase, the player pursues a path-extending strategy (see

below) from one border to a point that is quite obviously virtually connected to the other border.

slide-8
SLIDE 8

5 CONCLUSIONS 8

  • 2. In the second phase, the player realizes the virtual connection between

the endpoint of the first phase and the second border. By “path-extending strategy” from a cell x we mean a strategy like follows: In his first move the player occupies a neighbor of x. And whenever he

  • ccupies a cell z, then in his next move he will occupy a neighbor of z.

Figure 4 shows an illustration of this strategy.

x z z′ y

Figure 4: A path-extending strategy If such a strategy is pursued from a cell s until a cell t is reached, it is a special case of an s-t-direct-connecting strategy. But the following also holds: If there is a path-extending strategy from s to t′ and a t′-t-direct- connecting strategy, then we can put these strategies together and obtain an s-t-direct-connecting strategy. Actually, this is exactly the case in Reisch’s two-phases-construction. As remarked in the previous section, s and t (here: the borders) are then virtually connected.

5 Conclusions

As the set of virtual connections is PSPACE-complete one cannot afford performing an exhaustive H-search in general. Nevertheless, virtual con- nections have been proven useful in computer Hex. Apart from Hexy, the

slide-9
SLIDE 9

REFERENCES 9 relatively new but strong Hex program Six [six], whose source code is open, also makes use of Anshelevich’s virtual connections. But the calculation of virtual connections is still the bottleneck in the performance of Hex pro- grams. It is now clear that Hex programs must use heuristics in the calculation

  • f virtual connections. Therefore, these heuristics should not be seen as a

makeshift solution for not having found an efficient algorithm. We rather believe that these heuristics are the key point for further improvements. The future question will be: What are the best heuristics in H-search?

References

[Rei81] Reisch, Stefan: Hex ist PSPACE-vollst¨

  • andig. Acta Informatica

15, 167-191 (1981) [Ans02] Anshelevich, V. V.: A hierarchical approach to computer Hex. Artificial Intelligence 134, 101-120 (2002), ISSN 0004-3702 http://home.earthlink.net/~vanshel/VAnshelevich-ARTINT.pdf [six] http://six.retes.hu/