Minimax Algorithm & Alpha-Beta Pruning
Minimax Algorithm & Alpha-Beta Pruning
Minimax Algorithm & Alpha-Beta Pruning
& GAMES
The games most commonly studied within AI (such as chess,checkers
and Go)
Types of games:
• Deterministic eg Tic-tac toe.
• One, Two-player (Turn-taking) or more players
• Zero sum – no win-win situation
• Fully observable games
For games we often use the term move as a synonym for “action” and
position as a synonym for “state.”
Deterministic Games
• A game is said to be deterministic if the resolution of player actions
leads to a theoretically predictable outcome.
• One formalization of deterministic games is:
States: S (start at S0 )
Players: P ={1…N} (usually taking turns)
Actions: A (may depend on player/state)
Transition function: SxA S
Terminal Test: S {t,f}
Terminal Utilities: SxPR
General games can be formally defined with the following elements:
• S0: The initial state, which specifies how the game is set up at the start.
• TO-MOVE(s): The player whose turn it is to move in state s.
• ACTIONS(s): The set of legal moves in state s.
• RESULT(s, a): The transition model, which defines the state resulting
from taking action a in state s.
• IS-TERMINAL(s): A terminal test, which is true when the game is over
and false otherwise. States where the game has ended are called terminal
states.
• UTILITY(s, p): A utility function defines the final numeric value to player
p when the game ends in terminal state s.
In chess, the outcome is a win, loss, or draw, with values 1, 0, or 1/22
ACTIONS and RESULT function define the state space graph—a graph
where the vertices are states, the edges are moves and a state State
space graph might be reached by multiple paths
We define the complete game tree as a Game tree search tree that
follows every sequence of moves all the way to a terminal state. The
game tree may be infinite if the state space itself is unbounded or if
the rules of the game allow for infinitely repeating positions
Adversarial search
• Consider games where our agents have one or more adversaries who
attempt to keep them from reaching their goal(s).
• The easiest way to think about such games is as being defined by a
single variable value, which one team or agent tries to maximize and
the opposing team or agent tries to minimize, effectively putting them
in direct competition.
• In Pacman, this variable is your score, which you try to maximize by
eating pellets quickly and efficiently while ghosts try to minimize by
eating you first. Many common household games also fall under this
class of games e.g. chess, checkers & Go
To solve zero-sum games, we’ll use a
set of approaches called adversarial
search.
This is where you as an agent have
to think about as a function of what
you’ll do and what will the other
agent do…who is working against
you.
A (partial) game tree for the game of tic-tac-toe. The top node is the initial state,
and MAX moves first, placing an X in an empty square. We show part of the tree,
giving alternating moves by MIN (O) and MAX (X), until we eventually reach
terminal states, which can be assigned utilities according to the rules of the game