1 of 23

ADVERSARIAL SEARCH

  • The adversarial search can be employed in two-player zero-sum games which means what is good for one player will be the misfortune for the other. In such a case, there is no win-win outcome.
  • Searches in which two or more players with conflicting goals are trying to explore the same search space for the solution, are called adversarial searches, often known as Games
  • Adversarial search is a search technique used in AI for decision-making in competitive environments where one agent's goal conflicts with another agent's goal.

2 of 23

ADVERSARIAL SEARCH

Role of Adversarial Search in AI

  • Game-playing: The Adversarial search finds a significant application in game-playing scenarios, including renowned games like chess, Go, and poker. The adversarial search offers the simplified nature of these games that represents the state of a game in a straightforward approach and the agents are limited to a small number of actions whose effects are governed by precise rules.
  • Decision-making: Decision-making plays a central role in adversarial search algorithms, where the goal is to find the best possible move or strategy for a player in a competitive environment against one or more components.

3 of 23

TYPES OF GAMES IN AI

  • Perfect information: A game with the perfect information is that in which agents have all the information about the game, and they can see each other moves also. Examples are Chess, Checkers, etc.
  • Imperfect information: If in a game agents do not have all information about the game and not aware with what's going on, such type of games are called the game with imperfect information, such as Poker, blind search, Battleship etc.

4 of 23

TYPES OF GAMES IN AI

  • Deterministic games: Deterministic games are those games which follow a strict pattern and set of rules for the games, and there is no randomness associated with them.

Examples are chess, Checkers, Go, tic-tac-toe, etc.

  • Non-deterministic games: Non-deterministic are those games which have various unpredictable events and has a factor of chance or luck. This factor of chance or luck is introduced by either dice or cards. These are random, and each action response is not fixed. Such games are also called as stochastic games.

Example: Backgammon, Monopoly, Poker, Ludo etc.

5 of 23

TYPES OF GAMES IN AI

Zero-Sum Game

  • Zero-sum games are adversarial search which involves pure competition.
  • In Zero-sum game each agent's gain or loss of utility is exactly balanced by the losses or gains of utility of another agent.
  • One player of the game try to maximize one single value, while other player tries to minimize it.
  • Each move by one player in the game is called as ply.
  • Chess and tic-tac-toe are examples of a Zero-sum game.
  • Win =+1, loss=-1, Initially 0

6 of 23

TYPES OF GAMES IN AI

In this topic, we will discuss deterministic games, fully observable environment, zero-sum, and where each agent acts alternatively.

7 of 23

FORMALIZATION OF THE GAME PROBLEM:

A game 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.

8 of 23

FORMALIZATION OF THE GAME PROBLEM:

  • 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 (also called an objective function or payoff function), which 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 ½.

9 of 23

GAME TREE:

  • A game tree is a tree where nodes of the tree are the game states and Edges of the tree are the moves by players.
  • Game tree involves initial state, action function, and result function.

10 of 23

GAME TREE:

Example: Tic-Tac-Toe game tree:

  • Each player tries to choose moves that maximize their chance of winning while preventing the opponent from winning.
  • The following figure is showing part of the game-tree for tic-tac-toe game. Following are some key points of the game:
  • There are two players MAX and MIN.
  • Players have an alternate turn and start with MAX.
  • MAX maximizes the result of the game tree
  • MIN minimizes the result.

11 of 23

GAME �TREE:

12 of 23

GAME TREE:

From the initial state, MAX has 9 possible moves as he starts first. MAX place x and MIN place o, and both player plays alternatively until we reach a leaf node where one player has three in a row or all squares are filled.

Both players will compute each node, minimax, the minimax value which is the best achievable utility against an optimal adversary.

Suppose both the players are well aware of the tic-tac-toe and playing the best play. Each player is doing his best to prevent another one from winning. MIN is acting against Max in the game.

So in the game tree, we have a layer of Max, a layer of MIN, and each layer is called as Ply. Max place x, then MIN puts o to prevent Max from winning, and this game continues until the terminal node.

In this either MIN wins, MAX wins, or it's a draw. This game-tree is the whole search space of possibilities that MIN and MAX are playing tic-tac-toe and taking turns alternately.

13 of 23

  • The Minimax algorithm, used in game AI, finds optimal moves by exploring a game tree, assuming both players play optimally.
  • Alpha-Beta pruning optimizes this by eliminating branches that won't affect the final decision.

OPTIMAL DECISIONS IN GAMES: MINI MAX ALGORITHM AND ΑLPHA –BETA PRUNING

14 of 23

MINIMAX ALGORITHM

  • The Mini-Max algorithm is a decision-making algorithm used in artificial intelligence, particularly in game theory and computer games.

It is designed to minimize the possible loss in a worst-case scenario (hence "min") and maximize the potential gain (therefore "max").

In a two-player game, one player is the maximizer, aiming to maximize their score, while the other is the minimizer, aiming to minimize the maximizer's score.

The algorithm operates by evaluating all possible moves for both players, predicting the opponent's responses, and choosing the optimal move to ensure the best possible outcome.

There are two players MAX and MIN.

Players have an alternate turn and start with MAX. MAX maximizes the result of the game tree

MIN minimizes the result.

15 of 23

MINIMAX ALGORITHM

16 of 23

MINIMAX ALGORITHM

  • Given a game tree, the optimal strategy can be determined by working out the minimax value of each state in the tree, which we write as MINIMAX(s).
  • The minimax value is the utility (for MAX) of being in that state, assuming that both players play optimally from there to the end of the game.
  • The minimax value of a terminal state is just its utility.
  • In a non terminal state, MAX prefers to move to a state of maximum value when it is MAX’s turn to move, and MIN prefers a state of minimum value (that is, minimum value for MAX and thus maximum value for MIN).

17 of 23

MINIMAX ALGORITHM

18 of 23

MINIMAX ALGORITHM

19 of 23

MINIMAX Example:

20 of 23

MINIMAX ALGORITHM

  • The minimax algorithm performs a complete depth-first exploration of the game tree.
  • Complete- Min-Max algorithm is Complete. It will definitely find a solution (if exist), in the finite search tree.
  • Optimal- Min-Max algorithm is optimal if both opponents are playing optimally.
  • If the maximum depth of the tree is m and there are b legal moves at each point, then the time complexity of the minimax algorithm is O(bm).
  • The space complexity is O(bm) for an algorithm that generates all actions at once, or O(m)

21 of 23

MINIMAX ALGORITHM

22 of 23

MINIMAX ALGORITHM

Limitations of the Mini-Max Algorithm

Despite its usefulness, the Mini-Max algorithm comes with limitations:

    • Computational Complexity
    • No Probabilistic Handling
    • Exponential Time Complexity

23 of 23

MINIMAX ALGORITHM

Applications of the Mini-Max Algorithm

  • Game Theory: It’s extensively used in strategic games like chess, checkers, and tic-tac-toe.
  • AI in Robotics: Mini-Max helps robots make optimal decisions when faced with adversarial situations.
  • Economics: The algorithm is used in decision-making models where two entities with conflicting goals must make optimal moves.
  • Decision-making in AI: Beyond games, Mini-Max is applied in AI systems that require optimal decision-making in competitive environments.