On optimal Play in the Game of Hex - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

On optimal Play in the Game of Hex

Description:

These two white pieces are 'virtually connected' because even if it is ... Virtual Connections are treated as having resistance 0 if they are yours, and ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 31
Provided by: frankbergm
Category:
Tags: de | game | hex | optimal | piece | play | resistance

less

Transcript and Presenter's Notes

Title: On optimal Play in the Game of Hex


1
On optimal Play in the Game of Hex
  • By Chris Senkler and Frank Bergmann

2
Topics
  • Short Reminder
  • What is Hex?
  • History of Hex
  • Optimal Play in the Game of Hex
  • An Automatic Theorem Proving Approach to Game
    Programming

3
What is Hex?
  • Rules
  • The game starts with an empty board of hexagonal
    tiles. Each player owns 2 opposite sides of
    the board. Players alternate turns placing
    pieces on the tiles, one player taking white
    pieces and the other taking black.
  • The first player to create a string to touching
    tiles of their color connecting their two sides
    wins.
  • It is also known that the Game of Hex cannot end
    in a draw.
  • Nash proved in 1949 that player I always has a
    winning strategy for symmetric boards.

4
History Of Hex
  • The game was first presented in 1959 in
    Scientific American.
  • Invented in 1942 by Piet Hein.
  • Independently rediscovered by Nash in 1948.
  • Important to Mathematics mostly because of its
    relation to the Brower Fixed Point Theorem.

5
Optimal Play in the Game of Hex
6
Introduction
  • This part of the presentation will concentrate on
    two points
  • What is the shortest path with which player one
    can guarantee a win?
  • What is the minimal number of moves player one
    must make to guarantee a win?

7
The Shortest Path
  • Let Hex(n,l) be a Hex game of size n with the
    added constrain that player one wins only by
    constructing a path of length less then or equal
    to l.
  • In such a game a draw is possible.
  • Define ?(n) min l player I has a winning
    strategy for Hex(n,l)
  • Instead of determining ?(n) exactly, determine a
    lower bound for ?(n).

8
Lower bound for ?(n)
  • If ?(n) gt n, then ?(n1) gt n1
  • Inductive proof
  • All Hex(n1,n1) winning paths for player one
    must either
  • Contain a Hex(n,n) winning path for player one
    through the standard n x n sub-board or
  • Contain both 1,n and 1,(n1)
  • Assume that ?(n) gt n, this means that player two
    can prevent a winning Hex(n,n) path for player
    one on the n x n sub-board.
  • Whenever I plays on the n x n sub-board II
    follows his strategy, otherwise he can play on
    1,n or 1,(n1).
  • ? Player I cant have a winning path in
    Hex(n1,n1)
  • For the initial case consider ?(4) gt 4

9
Proving ?(4) gt 4Categories
  • There are up to symmetry four categories of
    distinct first moves.
  • In order to show ?(4) gt 4 each opening move will
    be considered along with continuing paths.

10
Proving ?(4) gt 4Category I
Player I Blue Player II Red
  • Blue cannot prevent a connection between the top
    red edge and the bottom red edge
  • ? blue cannot win Hex(4,4) with an opening move
    from category I

11
Proving ?(4) gt 4Category II
Player I Blue Player II Red
  • If blue begins with an opening move in category
    II, red immediately occupies the corner point and
    thus eliminated the possibility of any winning
    path of length 4.
  • ? blue cannot win Hex(4,4) with an opening move
    from category II

12
Proving ?(4) gt 4Category III
Player I Blue Player II Red
  • Blue cannot prevent a connection between the top
    red edge
  • ? blue cannot win Hex(4,4) with an opening move
    from category III

13
Proving ?(4) gt 4Category III
Player I Blue Player II Red
  • Blue cannot prevent a connection between the top
    red edge and the bottom red edge
  • ? blue cannot win Hex(4,4) with an opening move
    from category III

14
Proving ?(4) gt 4Category IV
Player I Blue Player II Red
  • Blue cannot reach the opposite border with a path
    of length 4
  • ? blue cannot win Hex(4,4) with an opening move
    from category IV
  • ? There exists no opening move that allows player
    one to construct a winning path with length 4 or
    less.

15
Minimal number of Counters
  • Let Hexd(n) be the game of Hex(n) with the added
    constraint that player one must win by playing at
    most d counters.
  • Define d(n) min d player one can guarantee
    a win at Hexd(n)
  • Again only a lower bound will be established. (A
    trivial lower bound would be d(n) ?(n))

16
Lower bound for d(n)
  • d(n) n ?n/4?
  • Proof
  • Divide the n x n board into nx4 sub-boards Hk and
    one n x (n-4?n/4? ) sub-board H.
  • In order to win Hex(n) player one must have a
    winning path across H and each Hk.
  • Player one can complete a path across H with
    (n-4?n/4? ) counters but for each k, player one
    needs at least 5 counters.
  • ? Player one needs at least
  • 5?n/4? (n-4?n/4? ) n ?n/4?
  • counters to complete a winning path in Hex(n)

17
Summary
  • A lower bound for the shortest path length and
    the minimal number of counters could be
    established for Hex games of size n
  • Shortest path length ?(n) gt n for all n 4
  • Minimal number of counters d(n) n ?n/4?

18
The Game of Hex
  • An Automatic Theorem Proving Approach to Game
    Programming

19
Connections
Two pieces are connected if they are of the same
color and share an edge. These 2 white
pieces are connected. The black pieces are not.
20
Virtual Connections
These two white pieces are virtually connected
because even if it is blacks turn White can
connect. If black A, white B, and visa versa
A
B
21
The Problem
  • Computers evaluate a game tree, which is hard for
    a game like chess, where there are an average of
    about 40 legal moves from a given game position.
    Hex has an average of over 100 on most sizes of
    board, which makes a complete analysis
    impossible.
  • Without a concrete way of evaluating a position,
    a computer has to play out every branch to the
    end before knowing if it was a good move or not.

22
Common Virtual Connections
Two Bridge connects 2 stones
Edge Connection from fourth row
23
Ladder connection
Connects either stone to the bottom edge.
24
Why Virtual connections are Good
The computer can reduce the game tree because it
no longer has to consider moves at the X points,
because the responses to these are wrote.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
25
Circuits
  • In order to solve the other problem mentioned
    earlier we need a concrete way to evaluate game
    positions in which one player has not yet won.
    To do this we put the game in terms of something
    that the computer can understand. We equate it
    to electrical resistance in a circuit.

26
We apply opposite charges to the sides of the
board. We Evaluate the position for Black first,
and then for white. For black We assign the
value rb(c)1 if c is empty, rb(c)0 if c has a
black piece, and rb(c)infinity if c is occupied
by a white piece. For each pair of neighboring
cells we associate the electrical link with the
resistance rb(c1,c2)rb(c1)rb(c2). Virtual
Connections are treated as having resistance 0 if
they are yours, and infinity if they belong to
the other player.
X
Y
27
We repeat this operation for white, using similar
algorithms. The overall position is now given by
the formula ERb/Rw. If E ever reaches 0, black
has a clear path to victory, and if E ever goes
to infinity white has a clear path to victory.
X
Y
28
Using this algorithm, the computer can
  • Evaluate the current game position
  • Evaluate the relative value of different moves
  • Stop an evaluation of a branch of the game tree
    once the equation E reaches 0 or infinity.

29
Summary
  • In order to make it possible for a computer to
    play intelligently in hex it is necessary to
    reduce the branches of the game tree that are
    analyzed and to evaluate the position of a game
    even if one player has not yet won. This can be
    done by the use of virtual connections and by
    treating the board as an electrical circuit whose
    positional value is measured as the electrical
    resistance.

30
References
  • 1 Garikai Campbell, on optimal play in the game
    of Hex, INTEGERS Electronic Journal of
    Combinatorial Number Theory, vol. 4, G2, 2004
  • 2 Vadim V. Anshelevich, The Game of Hex An
    Automatic Theorem Proving Approach to Game
    Programming, Proceedings of the Seventeenth
    National Conference on Artificial Intelligence
    (AAAI-2000), pp.189-194, 2000
Write a Comment
User Comments (0)
About PowerShow.com