Sunteți pe pagina 1din 7

Games and strategies AI seminar 2

A game consists of:


1. a set of players,
2. a set of moves (or strategies) available to those players, and
3. a specification of payoffs for each combination of strategies.
There are two ways of representing games that are common in the literatre
! The normal (or strategic form) game is a matri" which shows the players, strategies,
and payoffs (see the e"ample to the right). #ere there are two players$ one chooses
the row and the other chooses the colmn. %ach player has two strategies, which are
specified by the nmber of rows and the nmber of colmns. The payoffs are
provided in the interior. The first nmber is the payoff received by the row player
(Player 1 in or e"ample)$ the second is the payoff for the colmn player (Player 2
in or e"ample). &ppose that Player 1 plays top and that Player 2 plays left. Then
Player 1 gets ', and Player 2 gets (. )hen a game is presented in normal form, it is
presmed that each player acts simltaneosly or, at least, withot *nowing the
actions of the other. If players have some information abot the choices of other
players, the game is sally presented in e"tensive form.
! The e"tensive form can be sed to formali+e games with some important order.
Games here are presented as trees (as pictred to the left). #ere each verte" (or
node) represents a point of choice for a player. The player is specified by a nmber
listed by the verte". The lines ot of the verte" represent a possible action for that
player. The payoffs are specified at the bottom of the tree. In the game pictred here,
there are two players. Player 1 moves first and chooses either F or U. Player 2 sees
Player 1's move and then chooses A or R. &ppose that Player 1 chooses U and then
Player 2 chooses A, then Player 1 gets , and Player 2 gets 2. The e"tensive form
can also captre simltaneos!move games. %ither a dotted line or circle is drawn
arond two different vertices to represent them as being part of the same information
set (i.e., the players do not *now at which point they are).
Games classification
! by nmber of players
o with a player
o with more players
! by moves natre
o games with free moves - the move is constiently chosen from a set of
possible actions
o games with random moves - dies, card games, coins
o games with mi"ed moves
! by information .antity
o games with perfect information ! players know the moves previously
made by all other players ex. chess, go, mancala, and arimaa.
/erfect 01 complete - Complete information reuires that every player
know the strategies and payoffs of the other players but not
necessarily the actions.
o games with partial (imperfect) information - card games
2ara 3io4an 5
Games and strategies AI seminar 2
!ame strategy " the rles that define ni.ely the free moves for a player ta*ing into
accont the crrent state of the game.
In game theory, a player6s strategy is a complete plan of action for whatever sitation
might arise$ this flly determines the player6s behavior. A player6s strategy will
determine the action the player will ta*e at any stage of the game, for every possible
history of play p to that stage.
A strategy profile is a set of strategies for each player which flly specifies all actions in
a game. A strategy profile mst inclde one and only one strategy for every player.
The strategy concept is sometimes (wrongly) confsed with that of a move. A move is
an action ta*en by a player at some point dring the play of a game (e.g., in chess,
moving white6s 7ishop a2 to b(). A strategy on the other hand is a complete algorithm
for playing the game, implicitly listing all moves and conter!moves for every possible
sitation throghot the game. The nmber of 8moves8 in a Tic Tac Toe game is ' or 9,
depending on whether yo start or not, and considering that neither player can s*ip a trn$
while the actal nmber of 8strategies8 is over : trillion.
#trategy types$
! symmetry strategy
! pairs strategy
! parity strategy
! dynamic programming strategy
! and;or graphs strategy
! others
Conditions$
! each game has a finite nmber of steps
! a game does not contain random elements (dies, cards, coins)
! games with complete information
! the players move alternatively
2ara 3io4an 2
Games and strategies AI seminar 2
% #&''()*& #)*%)(!&
! a player A imitates the moves of the other player 7 ta*ing into accont a
symmetry a"is
! one a"is or two a"is (in this case we have a symmetry centre at the intersection of
the two symmetry a"is)
! if the player 7 can move then the player A can also ma*e a move 1< the game
will be over when the player 7 can not ma*e a new move.
! If the player 7 moves first, then the game is split (brea* p) into two parts one for
player 7 moves and another part for player A moves (that are symmetric with the
A=s moves)
! It is possible that the first move to not have a symmetric pair move
+1 ,omino game
We have a rectangular board with N*M cells Alternately! two "layers A and # draw two cells $a
%o&ino' which are e&"ty until that &o&ent (he "layer unable to "er)or& a &ove is the looser
o) the ga&e Find a "er)ect strategy )or co&"uter! the other "layer being a hu&an one (he
co&"uter &oves )irst
*onstrains+ At least one o) the nu&bers N and M &ust be even
a) n,m - even
75 75 A'
79 79 A'
7( A: A:
7( A2 A2
)inner is A
b) n! even, m !odd
7 cold win the game if he chooses to draw two cells from the forth colmn. .
+2 Coins
We have n coins that are "laced on a circle such as each coin adheres to its neighbours
Alternatively! two "layers &ove a coin or two glued coins (he "layer # starts the
ga&e (he "layer that ta,es a coin last ti&e is the winner
If 7 ta*es a coin 1< it will be n!5 coins 1< an array with n!5 coins
If 7 ta*es 2 coins 1< it will be n!2 coins 1< an array with n!5 coins
If n!5 ; n!2 - even 1< A ta*es the 2 ob>ect from the array middle and then it will imitate
the 7=s moves 1< A wins the game
2ara 3io4an (
Games and strategies AI seminar 2
If n!5 ; n!2 - odd 1< A ta*es one ob>ect from the array middle and then it will imitate the
7=s moves 1< A wins the game
- +%.*# #)*%)(!&
! a generali+ation of symmetry strategy
! at each step, a player A will ma*e the pair!move of the player 7=s move.
! It is possible that the initial move does not have a pair
! There are virtal!dominos - hori+ontal paired cells, horse step, etc.
+2 Cell cutting up
A rectangular "a"er is divided into N*M cells Alternatively! two "layers cut-u" a cell
that is the neighbour $on hori.ontal or vertical' ) the last cut-u" cell $by he other "layer'
(he "layer A starts the ga&e (he "layer that cut-u" the last cell is the winner
Restrictions+ a ell is cut-u" only once
5) n?m - even nmber 1< 7 always wins
A 7
!! !! @ !! !!
@ A @ !! !!
@ 7 @ !! !!
!! !! @ !! !!
2) n?m - odd nmber 1< A always win
A moves a cell, then 7 and then A imitates 7
% // // // //
// // // // 0
// // // // 0
+3 the same problem as +1, but we consider the diagonal neihborhood
5) n, m - even nmbers 1< 7 wins
A
7
A
A
A
A
A
A
7A 7A 7A
7A 7A A
A
2ara 3io4an
7 A
'
Games and strategies AI seminar 2
A
A
A
A
2) n - even nmber, m - odd nmber 1< A wins
A
7
A
A
A
A
AA
7A 7A
C +%*.)& #)*%)(!&
! we have two position (state) types
o even state (ni.e state)
o odd state (non!ni.e state)
! each state is defined in favor to one of the players(let=s say to player A favor) 1<
at each step, A will move in order o transform the odd state of the game into an
even game state (B !< %).
! the player 7 can transform the even state into an odd state (%!<B)
! the final state is an even state.
! If the initial state is an odd one, then the player that starts the game, will win the
game
o If A starts: 1 - there is a move of (A) !< ( - for all moves of 7!< 1-
there is a move of (A) !< (
o If 7 starts: ( - for all moves of 7!< 1- there is a move of (A) !< (
+2 2im
We have N stac,s each having "/i0 ob1ects Alternately! two "layers A and # e2tract )ro& a single
stac, any nu&ber o) ob1ects (he "layer "er)or&ing the last &ove is the winner o) the ga&e Find
a "er)ect strategy )or co&"uter! the other "layer being a hu&an one (he co&"uter &oves )irst
Cim is one of the oldest and thrilling mathematical game. Its origin is probably Dhinese
and in its original form, it contained ' stac*s with 2, 2, ' and E, respectively, coins.
The first analysis of this game was performed and pblished in 5FG5 by professor Dharles
2eonard 7oton, from #arvard niversity.
The soltion of this game spposes to divide the set of game positions into two classes (C
and &) and becase any natral nmber can be decomposed as a ni.e sm of powers of
2 (actally, it is based on the binary digital sm).
Hor defining a game state, we mst consider the coins nmber from each stac* - in this
way we obtain an n!pla (a$1'!a$2'!!a$n').
2ara 3io4an 9
Games and strategies AI seminar 2
,ef. A state (or an n!pla) is a singlar position game if and only if all nmbers 2
s
, where
s 1G,5,I, is represented (in the state (a$1'!a$2'!!a$n')) or an even nmber times.
A game position is non!singlar if it is not singlar.
). Hrom an even position, ma*ing any moves, we arrive into an odd position.
In an even position, each power of 2 appears for an even nmber times. If we e"tract
several coins from a stac*, then there will be some powers of 2 that will appear for odd
times.
&5: 2 1 2
5

&2: ( 1 2
5
J 2
G

&(: ' 1 2
2

&': 9 1 2
2
J 2
G
2
G
- 2, 2
5
- 2, 2
2
- 2,
! Hrom an even stac*
o %ven coins ! 2 coins from &( 1 <
&5: 2 1 2
5

&2: ( 1 2
5
J 2
G

&(: 2 1 2
5

&': 9 1 2
2
J 2
G
1< 2
G
- 2, 2
5
- (, 2
2
- 5 1< odd state
o Bdd coins - 5 coin from &5
&5: 5 1 2
G

&2: ( 1 2
5
J 2
G

&(: ' 1 2
2

&': 9 1 2
2
J 2
G
1< 2
G
- (, 2
5
- 5, 2
2
- 2 1< odd state
! Hrom an odd stac*
o %ven coins ! 2 coins from &' 1 <
&5: 2 1 2
5

&2: ( 1 2
5
J 2
G

&(: ' 1 2
2

&': ( 1 2
5
J 2
G
1< 2
G
- 2, 2
5
- (, 2
2
- 2 1< odd state
o Bdd coins - 5 coin from &(
&5: 2 1 2
G

&2: 2 1 2
5

&(: ' 1 2
2

&': 9 1 2
2
J 2
G
1< 2
G
- 2, 2
5
- 5, 2
2
- 2 1< odd state
). Hrom an odd state, ma*ing a convenient move, it is possible to obtain an even state.
The *ey to the theory of the game is the binary digital sm of the heap si+es, that is, the
sm (in binary) neglecting all carries from one digit to another. This operation is also
2ara 3io4an :
Games and strategies AI seminar 2
*nown as e"clsive or ("or). )ithin combinatorial game theory it is sally called the
nim/sum.
In normal play, the winning strategy is to finish every move with a Cim!sm of G, which
is always possible if the Cim!sm is not +ero before the move. If the Cim!sm is +ero,
then the ne"t player will lose if the other player does not ma*e a mista*e. To find ot
which move to ma*e, let K be the Cim!sm of all the heap si+es. Ta*e the Cim!sm of
each of the heap si+es with K, and find a heap whose si+e decreases. The winning
strategy is to play in sch a heap, redcing that heap to the Cim!sm of its original si+e
with K. Hor instance, if we have three stac*s &5((), &2(') and &((9), ta*ing the Cim!sm
of the si+es is K 1 ( KBL ' KBL 9 1 2. The Cim!sms of the heap si+es &51(, &21',
and &(19 with K12 are
&5 KBL K 1 ( KBL 2 1 5
&2 KBL K 1 ' KBL 2 1 :
&( KBL K 1 9 KBL 2 1 E
The only heap that is redced is heap &5, so the winning move is to redce the si+e of
heap &5 to 5 (by removing two ob>ects).
+2 -achet
We have a stac, with n ob1ects Alternately! two "layers A and # e2tract )ro& the stac, &a2i& ,
ob1ects (he "layer "er)or&ing the last &ove is the winner o) the ga&e Find a "er)ect strategy
)or co&"uter! the other "layer being a hu&an one (he co&"uter &oves )irst
An even state - when n mod (*J5) 1 G
An odd state - when n mod (*J5) 01 G
Hinal state mst be an even state.
Hor all moves % !< B - we will ta*e * ob>ects
There is a move B !< % - we will ta*e (n mod (*J5)) ob>ects
2ara 3io4an E

S-ar putea să vă placă și