ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Artificial Intelligence
    COMP2121
    Progress0 / 19 topics
    Topics
    1. An Introduction to Artificial Intelligence and its applications towards Knowledge Based Systems2. Introduction to Reasoning and Knowledge Representation3. Problem Solving by Searching: Informed searching4. Problem Solving by Searching: Uninformed searching5. Heuristics in Problem Solving6. Local searching algorithms7. Minimax algorithm8. Alpha-beta pruning9. Game-playing in AI10. Case Study: General Problem Solver11. Case Study: ELIZA12. Case Study: Student13. Case Study: Macsyma14. Learning from examples15. Artificial Neural Networks (ANN)16. Natural Language Processing17. Recent trends and applications of AI algorithms18. Python programming for AI19. Implementation of AI techniques in Python
    COMP2121›Minimax algorithm
    Artificial IntelligenceTopic 7 of 19Regular Notes

    Minimax algorithm

    2 minread
    336words
    Beginnerlevel

    📘 Problem Solving by Searching: Minimax Algorithm


    1. What is the Minimax Algorithm?

    The Minimax algorithm is used in two-player, turn-based, zero-sum games (like Tic-Tac-Toe, Chess, or Checkers). It helps AI choose the best move assuming the opponent also plays optimally.

    It aims to maximize the AI’s gain while minimizing the opponent’s gain — hence the name minimax.


    2. Key Concepts

    Term Explanation
    Maximizer The AI player, trying to get the highest score
    Minimizer The opponent, trying to minimize the AI’s score
    Utility Value Numeric score assigned to terminal states (win = +1, lose = –1, draw = 0)
    Game Tree A tree of all possible moves and their outcomes
    Zero-sum Game One player’s gain is another player’s loss

    3. How Minimax Works

    1. Generate the game tree from the current state.

    2. Evaluate terminal states using a utility function.

    3. Propagate values up the tree:

      • Max nodes choose the maximum value of their children.
      • Min nodes choose the minimum value of their children.
    4. Choose the move that leads to the best value at the root (AI's turn).


    4. Example: Simple Game Tree

              [AI]
              Max
             /    \
          Min     Min
         / \      / \
       +1  0    -1  +1
    
    • At Min nodes: pick the minimum child value → First Min: min(+1, 0) = 0 → Second Min: min(–1, +1) = –1

    • At Max (AI): pick the maximum of 0 and –1 → Best move = 0


    5. Time Complexity

    • Time: O(b^m)

      • b = branching factor (possible moves per turn)
      • m = maximum depth of the game tree
    • Space: O(m) for depth-first implementation


    6. Optimization: Alpha-Beta Pruning

    Minimax can be optimized with Alpha-Beta pruning, which:

    • Eliminates branches that don't need to be explored.
    • Reduces time complexity from O(b^m) to O(b^(m/2)) in the best case.

    ✅ Summary

    Concept Meaning
    Minimax Algorithm for two-player adversarial games
    Maximizer AI’s turn – aims to maximize utility
    Minimizer Opponent’s turn – aims to minimize AI’s score
    Game Tree All possible future game states
    Use Games like Tic-Tac-Toe, Chess, etc.
    Optimized by Alpha-Beta Pruning

    Previous topic 6
    Local searching algorithms
    Next topic 8
    Alpha-beta pruning

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time2 min
      Word count336
      Code examples0
      DifficultyBeginner