You are on page 1of 7

Ri

hman Ti Ta Toe Game


Mi hael Fan

May 16, 2004

1 Introdu tion
For the omputer s ien e departmental honors proje t, I reated a program
for a Ri hman version of Ti Ta Toe. Ri hman games, more te hni ally
known as ombinational games under au tion bidding, are a type of game
reated by David Ri hman in the 1980's that ombine the aspe ts of ombi-
national and matrix games. The purpose of this proje t was to understand
the theory behind a Ri hman game, to extend in onto a game of Ti Ta
Toe, and develop a winning strategy for the game.
The rst part of the proje t was to understand the theory behind a Ri h-
man game and develop a winning strategy for the omputer in the Ri hman
Ti Ta Toe game. Lazarus et al. des ribed a winning strategy for Ri hman
games on a graph and I simpli ed their algorithm to apply to only dire ted
a y li graphs. Se tions 2-4 des ribe Ri hman games and the simpli ed al-
gorithm.
The se ond part of the proje t was to ode the Ri hman Ti Ta Toe
game. The oding was broken down into a two step pro ess. The rst step
was to onvert the game of Ti Ta Toe into a dire ted a y li graph. After
the game was redu ed into graph form, the se ond step was to al ulate the
Ri hman osts for the entire graph so an optimal strategy for the omputer
ould be used. Se tion 5 des ribes the pro ess of oding the Ri hman game
of Ti Ta Toe.
Finally, this proje t is still a work in progress. Se tion 6 des ribes the
various improvements in the proje t that will be made over the next year.

1
2 Introdu tion to Ri hman Games
David Ri hman in the late 1980s introdu ed a new type of game theory:
Combinational Games under Au tion Bidding or Ri hman Games. This new
theory ombined hara teristi s of Combinational Games and Matrix Games.
In ombinational games, su h as hess, he kers, and Nim, two players al-
ternate turns making moves. In matrix games, su h as ro k, paper, s issors,
two players simultaneously make moves. In a Ri hman game, ea h player
begins with a xed pool of money. Before ea h move, ea h player simultane-
ously bids to make the move; the player who bids higher makes a move (ties
are resolved by a oin ip) and gives the opponent the dollar amount of the
winning bid. The loser of the bid does not make a move. This pro ess is
repeated until a player wins.
For a Ri hman game on a graph, the game begins with a token on a
vertex of a graph and ea h player has a separate end vertex. The goal of
ea h player is to move the token onto his end vertex. During ea h move,
ea h player bids to move the token to an adja ent vertex and the game ends
when a player moves the token to his vertex. Lazarus et al. [1,2℄ determined
an optimal algorithm to winning a Ri hman game on graphs. The purpose
of this paper is to elu idate this algorithm and apply it to dire ted a y li
graphs (DAGs).

3 Ri hman Cost Fun tion


In this algorithm, the two players known as Ms. Red and Mr. Blue, and
respe tively their end verti es are r and b. Also, the total amount of money
is de ned as 1, and Red and Blue possess fra tions of this total that add up
to the total amount of money. Finally, throughout this paper, G will denote
a dire ted a y li graph (V; E ), with V denoting the set of G and with E
denoting the set of edge of G, with verti es r and b, su h that from every
vertex there is a path to either r or b. The key to the algorithm, is the
statement that:
For every dire ted a y li graph G with a token lo ated on vertex
v , there exists a riti al ration R(v ), su h that if Blue's money
is greater than R(v ), he has a guaranteed winning strategy. Re-
spe tively, if Red's money is more than 1 R(v ), then she has a
guaranteed winning strategy.

2
This R(v ) ratio is known as the Ri hman Cost Fun tion.

3.1 De nition of Ri hman Cost Fun tion


For ea h vertex 2 , let ( ) denote the set of su essors of in . In
v V S v v G

other words, ( ) = f 2
S v : ( ) 2 g. Finally, given any fun tion
w V v; w E

f : ! [0 1℄, let
V ;

f
+
(v ) = max f (w) and f (v ) = min f (w)
w2S (v) w2S (v)

With these de nitions in mind, the Ri hman Cost Fun tion is for v 2 V
R v ( ) = (R+ (v ) + R (v ))=2
with R(b) = 0 and R(r) = 1. Or in other words, the Ri hman ost of v is
the average of the maximum and minimum Ri hman ost of v's su essors.

3.2 Algorithm for Cal ulating Ri hman Costs on a DAG


To keep tra k of whi h nodes' Ri hman value hasn't been set, the algorithm
assigns a olor to ea h node (either white, gray, or bla k.) White nodes
haven't been visited by the algorithm, gray nodes have been visited but all
their hildren haven't been visited, and bla k nodes have been visited and all
their hildren have been visited. The olor information for ea h node is kept
in an array named olor; for ea h vertex v 2 V in G, olor[v℄ will return the
vertex's olor.
Ri hman Cal ulate(vertex start vertex)
for ea h vertex v 2 V , intialize R(v ) to 1, expe t for R(b) = 0, and initialize
olor[v ℄ to white, ex ept olor[r℄ and olor[b℄ are set to bla k.
for ea h vertex y 2 S (start vertex)
Ri hman Visit(y )

Ri hman Visit(vertex y )
olor[y ℄ = gray
for ea h vertex z 2 S (y )
if olor[z℄ = white
then Ri hman Visit(z )
olor[y℄ = bla k

3
( ) = R+ (y ) + R (y ))=2
R y

Note: This algorithm is based on the depth- rst sear h algorithm. The
orre tness of the algorithm an be veri ed using Theorem 1 (below) and the
properties of a depth- rst sear h.

Theorum 1: Ea h vertex of dire ted a y li graph G has only one


valid Ri hman ost
Proof:
For ea h dire ted a y li graph, there are at least one so alled sink
verti es, verti es for whi h there are no outgoing edges. For our ase, the
two sink verti es are r and b. If r and b are removed from the graph, then
the resulting graph remains a DAG and still has sink nodes (in this ase
the nodes that had edges only to r and b) and their Ri hman ost an be
al ulated from r and b. This pro ess an be repeated (the sink verti es are
removed and the resulting graphs sink verti es Ri hman osts are al ulated)
until the start vertex is rea hed. When the Ri hman Cost for ea h vertex is
al ulated, it is only al ulated from verti es that have been removed from
previous graphs (otherwise the vertex would not be a sink vertex) and so the
Ri hman Cost will be set to that one valid ost.

4 The Optimal Strategy


So, the optimal algorithm begins by al ulating the Ri hman ost for ea h
vertex of the graph. On e the Ri hman osts are al ulated, when the to-
ken is at v , the optimal bid for both players is R(v ) R (v ) (this optimal
bid is equivalent to R+ (v ) R(v )). If Blue wins, Blue should move the to-
ken to the su essor of v with the minimum Ri hman ost. If Red wins, Red
should move the token to the su essor of v with the maximum Ri hman ost.

Theorem 2: If Blues share of the money ex eeds R(v ), then Blue


has a deterministi winning strategy. If Blues share is less than
R(v ), then Red has a deterministi winning strategy.

Proof by Strong Indu tion:

Base Case: If the token is on b and Blue's share of the money ex eeds
R(b) = 0, and so Blue wins sin e the token is on Blue's end vertex.

4
Indu tion Hypothesis: For all su essors w of v assume if Blue's share of
the money ex eeds R(w) when the token is on w, then Blue has a winning
strategy. Prove for v .

Blue bids the optimal bid of R(v ) R (v ).

If Blue wins the bid:


Blue's share of the money is subtra ted by R(v ) R (v ).

Blue's share of the money was greater than R(v ), so Blue's share
of the money is now greater than R(v ) (R(v ) R (v )).

Using some simple algebra,


( )
R v (R (v ) R (v )) = R(v ) ( ) + R (v ) = R (v )
R v

Blue's share of the money is greater than R (v ). Blue moves


the token to the su essor of v with the minimum Ri hman ost,
whi h has a Ri hman value of R (v ). By the Indu tion Hypoth-
esis, sin e Blue's share of the money is greater than R (v ) and
the Ri hman ost of the vertex the token is on is equal to R (v ),
Blue retains a winning strategy.
If Blue loses the bid:
Using the alternate form of the bid, Blue's share of the money is
in reased by R+ (v ) R(v ).

Sin e, Blue's share of the money was greater than R(v ), so Blue's
share of the money is now greater than R(v ) + (R+ (v ) R(v )).

After some simple algebra, Blue's share of the money is greater


than R+ (v ). Sin e the maximum Ri hman value of any of v 's
su essors is by de nition R+ (v ), no matter whi h su essor Red
moves the token to, Blue's share of the money is greater than the
Ri hman value of that su essor. So, by the Indu tion Hypothe-
sis, Blue retains a deterministi winning strategy.

5
This proof an easily be reversed for Red and the Ri hman fun tion repla ed
with 1 R(v ). If Blue's share of the money is less than R(v ) then Red's
share of the money is greater than 1 R(v ) and repeat the proof above to
show that Red has a deterministi winning strategy.

There is a third ase however, that Blue and Red's share of the money is
equal to that of R(v ). If both players play optimally, then Blue's share of
the money will ontinue to be equal to R(v ) and the resolution of tie bids is
by a oin ip, so the winning of the game is now by han e.

5 Pro ess of Implementation


As shown in the previous se tions, it is simple to devise a winning strategy
for a Ri hman game if the game an be redu ed into a graph format. To
implement the Ri hman game of Ti Ta Toe, the rst step was to redu e
Ti Ta Toe into a dire ted a y li graph game and then to run a fun tion
to determine the Ri hman osts of the entire graph.
The Ri hman Ti Ta Toe game was written entirely in Java. Sin e the
game is eventually going to have a visual interfa e and be web-a essable,
Java was the language best suited for these two implementing these two
features.
The original design was to in lude all the possible Ti Ta Toe board
on gurations as verti es in the graph. The verti es were onne ted with
edges that onne ted ea h vertex to the verti es that were one move away
further into the game. This design would result in a dire ted a y li graph
that represented all the possible ways a Ti Ta Toe game ould be played.
After some testing, it was dis overed that this design was untenable.
Originally, the program would attempt to reate the graph from s rat h ea h
time it was run. This lead to a lengthy start-up time. Afterwards, a hange
was made to pre-pro ess the Ti Ta Toe graph into a le format and load
the program from a le. This, however, still took a lengthy amount of time,
sin e the Ti Ta Toe graph would ontain 39 di erent verti es.
A se ond design was reated utilizing re e tions and rotations to minimize
the number of verti es and edges in the graph. For instan e, the empty board
has edges to eighteen separate board on gurations, two marks possible for
ea h square on the board. However, with re e tions and rotations, only six
verti es are ne essary: two enter, two side, and two orners. Rotations

6
or re e tions of ea h of these six verti es an represent ea h of the original
eighteen verti es. By utilizing re e tions, the number of edges and verti es
were de reased by a fa tor of ten.
However, Ti Ta Toe allows draws to o ur when the board is lled and
there is no winner. To resolve the problem in omputing Ri hman osts
for draw s enarios, draws were de ided to be wins for the human player.
This had the e e t of the human player having a slight advantage if both
the human and the omputer start with the same amount of money. With
this resolved, the Ri hman osts were al ulated and the optimum omputer
playing strategy ould be easily determined.
The ode for the game is urrently posted at www.wam.umd.edu/~mfan.

6 Improvements
This proje t is still in the development stages. As of now, the interfa e for
the game is very primitive and relies on the user reorientating re e ted and
rotated board on gurations in his mind. In the future, a visual interfa e
will be developed for the game. Also, there are plans to introdu e an error
into the omputer bidding pro ess and ompare the di eren e in performan e
between a small error and larger error in bidding.

Referen es
[1℄ Lazarus, Andrew et al. "Ri hman Games." In Games of No Chan e:

Combinational Games at MSRI, MSRI Publi ation Series 29, edited by


Ri hard J. Nowakowski, 439-450. Cambridge University Press, 1998.
[2℄ Lazarus, Andrew et al. "Combinatorial Games under Au tion Play."
Games and E onomi Behavior 27 (1999): 229-264.

You might also like