Adversial Search
Adversial Search
Adversial Search
AI Adversarial search
• Adversarial search is a game-playing technique where the agents are
surrounded by a competitive environment. A conflicting goal is given to the
agents (multiagent). These agents compete with one another and try to defeat
one another in order to win the game. Such conflicting goals give rise to
the adversarial search. Here, game-playing means discussing those games
where human intelligence and logic factor is used, excluding other factors
such as luck factor. Tic-tac-toe, chess, checkers, etc., are such type of
games where no luck factor works, only mind works.
• Mathematically, this search is based on the concept of ‘Game Theory.’
According to game theory, a game is played between two players. To
complete the game, one has to win the game and the other looses
automatically.’
• Techniques required to get the best optimal solution
• There is always a need to choose those algorithms which provide the
best optimal solution in a limited time. So, we use the following
techniques which could fulfill our requirements:
• Pruning: A technique which allows ignoring the unwanted portions of
a search tree which make no difference in its final result.
• Heuristic Evaluation Function: It allows to approximate the cost
value at each level of the search tree, before reaching the goal node.
• Elements of Game Playing search
• To play a game, we use a game tree to know all the possible choices and to pick the best one
out. There are following elements of a game-playing:
• S0: It is the initial state from where a game begins.
• PLAYER (s): It defines which player is having the current turn to make a move in the state.
• ACTIONS (s): It defines the set of legal moves to be used in a state.
• RESULT (s, a): It is a transition model which defines the result of a move.
• TERMINAL-TEST (s): It defines that the game has ended and returns true.
• UTILITY (s,p): It defines the final value with which the game has ended. This function is
also known as Objective function or Payoff function. The price which the winner will get
i.e.
• (-1): If the PLAYER loses.
• (+1): If the PLAYER wins.
• (0): If there is a draw between the PLAYERS.
Let’s understand the working of the elements with the help of a game tree designed for tic-tac-toe. Here, the node represents the game state and edges represent the moves ta
A game-tree for tic-tac-toe
• INITIAL STATE (S0): The top node in the game-tree represents the initial state in
the tree and shows all the possible choice to pick out one.
• PLAYER (s): There are two players, MAX and MIN. MAX begins the game by
picking one best move and place X in the empty square box.
• ACTIONS (s): Both the players can make moves in the empty boxes chance by
chance.
• RESULT (s, a): The moves made by MIN and MAX will decide the outcome of the
game.
• TERMINAL-TEST(s): When all the empty boxes will be filled, it will be the
terminating state of the game.
• UTILITY: At the end, we will get to know who wins: MAX or MIN, and
accordingly, the price will be given to them.
Types of algorithms in Adversarial search
• In a normal search, we follow a sequence of actions to reach the goal
or to finish the game optimally. But in an adversarial search, the
result depends on the players which will decide the result of the game.
It is also obvious that the solution for the goal state will be an optimal
solution because the player will try to win the game with the shortest
path and under limited time.
• There are following types of adversarial search:
• Minmax Algorithm
• Alpha-beta Pruning.
• In artificial intelligence, minimax is a decision-making strategy
under game theory, which is used to minimize the losing chances in a
game and to maximize the winning chances. This strategy is also
known as ‘Minmax,’ ’MM,’ or ‘Saddle point.’ Basically, it is a two-
player game strategy where if one wins, the other loose the game. This
strategy simulates those games that we play in our day-to-day life.
Like, if two persons are playing chess, the result will be in favor of
one player and will unfavor the other one. The person who will make
his best try,efforts as well as cleverness, will surely win.
• We can easily understand this strategy via game tree- where the nodes
represent the states of the game and edges represent the moves made
by the players in the game. Players will be two namely:
• MIN: Decrease the chances of MAX to win the game.
• MAX: Increases his chances of winning the game.
• They both play the game alternatively, i.e., turn by turn and following
the above strategy, i.e., if one wins, the other will definitely lose it.
Both players look at one another as competitors and will try to defeat
one-another, giving their best.
• In minimax strategy, the result of the game or the utility value is
generated by a heuristic function by propagating from the initial node
to the root node. It follows the backtracking technique and
backtracks to find the best choice. MAX will choose that path which
will increase its utility value and MIN will choose the opposite path
which could help it to minimize MAX’s utility value.
MINIMAX Algorithm