Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
INTELLIGENT
SYSTEMS
GAME PLAYING 2
AI and Game Playing
•A game consists of a set of two or more players, a set of moves for the
players, and a specification of payoffs (outcomes) for each combination
of strategies.
•Many different types of games:
• two-person zero-sum
• multi-player
• perfect information games
• imperfect information games
AI and Game Playing
Two-person Zero-sum
◦ These games involve only two players; they are The payoff matrix shown below
called zero-sum games because one player wins represents the payoff to player 1.
whatever the other player loses.
◦ Example: Odds and Evens
◦ Suppose that player 1 takes evens and player 2
takes odds. Then, each player simultaneously shows
either one finger or two fingers. If the number of
fingers matches, then the result is even, and player
1 wins the bet ($2). If the number of fingers does
not match, then the result is odd, and player 2 wins
the bet ($2). Each player has two possible
strategies: show one finger or show two fingers.
AI and Game Playing
Two-person Zero-sum
Basic Concepts of Two-Person Zero-Sum Games
This game of odds and evens illustrates important concepts of simple games.
•A two-person game is characterized by the strategies of each player and the
payoff matrix.
•The payoff matrix shows the gain (positive or negative) for player 1 that would
result from each combination of strategies for the two players. Note that the
matrix for player 2 is the negative of the matrix for player 1 in a zero-sum game.
•The entries in the payoff matrix can be in any units as long as they represent
the utility (or value) to the player.
•There are two key assumptions about the behavior of the players. The first is
that both players are rational. The second is that both players
are greedy meaning that they choose their strategies in their own interest (to
promote their own wealth).
AI and Game Playing
Multi-player
•More than one player at a time
•Spacewar is the first multiplayer game and running on a computer
(1961) (made more than $100 000)
•Tennis for Two is the very first multiplayer game running on an
oscilloscope(1958)
•1960s
• Progress and success in Game AI.
• Creating a successful AI meant coming up with the right rules for it to follow.
•1970s-1980s
• Transition to games as entertainment
• Using search based AI to emulate entertaining characters
•Early 1990s
• Increased realism becomes the primary focus of the game industry
• A rift develops between the developers of popular games and AI researchers
AI and Game Playing
CONCEPTS
Technologies / techniques used
AI and Game Playing
CONCEPTS
Technologies / techniques used
Game Playing
Strategies
16
Game Playing
Strategies
17
Game Playing
Strategies
18
MinMax - Overview
•MinMax the heart of almost every computer board game
•Applies to games where:
◦ Players take turns
◦ Have perfect information
◦ Chess, Checkers, Tactics
Min
Max
Min
24
Minimax Algorithm
(cont’d)
3 9 0 7 2 6
25
Minimax Algorithm
(cont’d)
3 0 2
3 9 0 7 2 6
26
Minimax Algorithm
(cont’d)
3
3 0 2
3 9 0 7 2 6
27
Minimax is done Depth-first
Serch
max
min
max
leaf
2 5 1
28
Minimax Algorithm
29
Game Tree Size
Tic-Tac-Toe
◦ b ≈ 5 legal actions per state on average, total of 9 plies in game.
◦ “ply” = one action by one player, “move” = two plies.
◦ 59 = 1,953,125
◦ 9! = 362,880 (Computer goes first)
◦ 8! = 40,320 (Computer goes second)
Chess
◦ b ≈ 35 (approximate average branching factor)
◦ d ≈ 100 (depth of game tree for “typical” game)
◦ bd ≈ 35100 ≈ 10154 nodes!!
30
Partial Game Tree for Tic-Tac-Toe
31