FAI Study Hub
← Back to Study Hub
Module 02 · Game & CSP
← Hub
Intuition Minimax Alpha-Beta Cryptarithmetic Traps Past Papers Simulator Quiz Checklist
Module 02 · Adversarial Games & Constraint Reasoning

Adversarial Search & Constraint Satisfaction

Master multi-agent decision trees and combinatorial constraint networks. Step-by-step verified solutions for Minimax bottom-up utility propagation, Alpha-Beta $[\alpha, \beta]$ branch pruning, and the classic SEND + MORE = MONEY cryptarithmetic puzzle.

May 2025 (Q4 20M) Nov 2025 (Q5 20M) Alpha-Beta (α ≥ β) Minimax (Root=5) SEND+MORE=MONEY (23)

01. Intuition & Concept Contrast

Unlike classical pathfinding where an agent acts in a passive environment, game playing features an active rational opponent whose goal is to minimize your outcome.

Adversarial Paradigm

Single-Agent vs Zero-Sum Game

Single-Agent Search (A*): Environment is deterministic and static. The agent plans a sequence of actions that reach the goal with minimal path cost.

Two-Player Zero-Sum (Minimax): Two players with diametrically opposed utility functions ($\text{Utility}_{\text{Max}} = -\text{Utility}_{\text{Min}}$). MAX maximizes score; MIN minimizes score.

Problem Solving Paradigm

State-Space Search vs CSP

State-Space Search: States are black boxes. Focuses on the sequence of actions that transforms Start into Goal.

Constraint Satisfaction (CSP): States have structured variables with finite domains. Focuses on assigning valid values to all variables that satisfy explicit constraints.

02. Minimax Mathematical Formulation

The Minimax Recursive Value Function
$$\operatorname{Minimax}(s) = \begin{cases} \operatorname{Utility}(s), & \text{if } \operatorname{Terminal}(s) \\ \max_{a \in \text{Actions}(s)} \operatorname{Minimax}(\operatorname{Result}(s, a)), & \text{if } \operatorname{Player}(s) = \text{MAX} \\ \min_{a \in \text{Actions}(s)} \operatorname{Minimax}(\operatorname{Result}(s, a)), & \text{if } \operatorname{Player}(s) = \text{MIN} \end{cases}$$

Properties of the Minimax Algorithm:

  • Completeness: Yes, if the game tree is finite.
  • Optimality: Yes, against an optimal opponent. If the opponent plays sub-optimally, Minimax still guarantees at least the minimax score.
  • Time Complexity: $O(b^m)$, where $b$ is the legal branching factor and $m$ is the maximum depth of the tree.
  • Space Complexity: $O(bm)$ using depth-first search traversal.

03. Alpha-Beta Pruning Algorithm

Alpha-Beta pruning computes the exact Minimax decision without exploring branches that cannot influence the final root outcome.

The Governing Alpha-Beta Pruning Invariant
$$\alpha \ge \beta \implies \text{Prune Remaining Child Branches!}$$ $\alpha$: Best (highest) score MAX can guarantee so far ($\alpha = -\infty$). $\beta$: Best (lowest) score MIN can guarantee so far ($\beta = +\infty$).

How Alpha and Beta Update at Tree Levels:

1. At MAX Nodes:

  • MAX tries to push the score as high as possible: $v = \max(v, \operatorname{ChildValue})$.
  • Update $\alpha$: $\alpha = \max(\alpha, v)$.
  • Pruning check: If $\alpha \ge \beta$, stop exploring remaining siblings. Prune!

2. At MIN Nodes:

  • MIN tries to push the score as low as possible: $v = \min(v, \operatorname{ChildValue})$.
  • Update $\beta$: $\beta = \min(\beta, v)$.
  • Pruning check: If $\beta \le \alpha$ (i.e., $\alpha \ge \beta$), stop exploring remaining siblings. Prune!
Computational Advantage of Alpha-Beta Pruning:
* With perfect move ordering (evaluating best moves first), time complexity drops from $O(b^m)$ to $O(b^{m/2}) = O((\sqrt{b})^m)$.
* This effectively **doubles the search horizon depth** in games like Chess and Checkers within the same computing time!

04. Constraint Satisfaction & Cryptarithmetic Puzzles

May 2025 (Q4.i) Guaranteed 10-Mark Question. The famous SEND + MORE = MONEY puzzle.

Formal CSP Problem Definition:

  • Variables: $\mathcal{V} = \{S, E, N, D, M, O, R, Y\}$ and column carries $\{C_1, C_2, C_3, C_4\} \in \{0, 1\}$.
  • Domains: $\mathcal{D} = \{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}$ with leading letter constraints $S \neq 0, M \neq 0$.
  • Global Constraint: $\operatorname{Alldifferent}(S, E, N, D, M, O, R, Y)$.
  • Column Addition Constraints (Right to Left): $$\begin{aligned} \text{Col 1 (Units):} & \quad D + E = Y + 10 \cdot C_1 \\[3pt] \text{Col 2 (Tens):} & \quad N + R + C_1 = E + 10 \cdot C_2 \\[3pt] \text{Col 3 (Hundreds):} & \quad E + O + C_2 = N + 10 \cdot C_3 \\[3pt] \text{Col 4 (Thousands):} & \quad S + M + C_3 = O + 10 \cdot C_4 \\[3pt] \text{Col 5 (Ten-Thousands):} & \quad C_4 = M \end{aligned}$$

05. Notation Decoding Matrix

Symbol Formal Name Plain-English Meaning Exam Benchmark
$\alpha$ Alpha Value Highest score guaranteed to MAX player along current path Initialized to $-\infty$; increases only at MAX nodes
$\beta$ Beta Value Lowest score guaranteed to MIN player along current path Initialized to $+\infty$; decreases only at MIN nodes
$C_i$ Carry Bit Integer carry forwarded to subsequent column in addition $C_i \in \{0, 1\}$
$\operatorname{Alldifferent}$ Global Constraint Enforces every letter must represent a unique decimal digit No two letters share the same integer

06. Repeatable Step-by-Step Solving Protocol

Step 1: Isolate the Leading Carry Digit ($M = 1$)

The sum of two single-digit numbers plus a carry is at most $9 + 9 + 1 = 19$. Therefore, the leftmost carry digit $M$ must equal $1$.

Step 2: Solve the Thousands Column ($S + 1 + C_3 = O + 10$)

Since $M = 1$, $O$ cannot be $1$. Because $S \le 9$, the sum $S + 1 + C_3 \le 11$. This forces $O = 0$ and $S = 9$ (with $C_3 = 0$).

Step 3: Solve the Hundreds Column ($E + 0 + C_2 = N$)

Because $E \neq N$, carry $C_2$ must be $1$, so $N = E + 1$.

Step 4: Solve Tens & Units via Elimination

Substitute $N = E + 1$ into tens column. Deduce $R = 8$, $E = 5$, $N = 6$, $D = 7$, and $Y = 2$.

Step 5: Verify the Arithmetic Sum & Target Equation

Confirm $9567 + 1085 = 10652$. Compute $N + E + E + D = 6 + 5 + 5 + 7 = 23$.

07. 6 Deadly Exam Traps & Common Student Mistakes

Trap 01: Updating Alpha at Min Nodes

Modifying $\alpha$ During MIN Player Turns

$\alpha$ belongs to MAX. At a MIN node, you only update $\beta$ ($\beta = \min(\beta, v)$). Updating $\alpha$ at a MIN node completely corrupts the pruning logic.

Trap 02: Missing Equality Pruning

Pruning Only When $\alpha > \beta$

The standard pruning condition is **$\alpha \ge \beta$ (greater than OR EQUAL)**. If $\alpha = 4$ and $\beta = 4$, the opponent already has an equal alternative; remaining branches must be pruned.

Trap 03: Overlooking $M = 1$ Direct Deduction

Brute Forcing Cryptarithmetic Digits

Trying arbitrary numbers wastes 20 minutes in the exam. Always start with the ten-thousands carry: $M = 1$ is instantaneous and immediately forces $O = 0$.

Trap 04: Duplicate Digit Assignments

Assigning the Same Digit to Two Letters

If $O = 0$ and $M = 1$, no other letter can be assigned $0$ or $1$. Always maintain a crossed-off list of remaining digits $\{2, 3, 4, 5, 6, 7, 8, 9\}$.

Trap 05: Not Stating Root Player Move

Reporting Only the Minimax Value

Writing "Optimal Value = 5" gets only half marks. You must state the action: "Optimal move for MAX is to choose Node B".

Trap 06: Swapping Level Types

Confusing MAX and MIN Layers

Check the problem definition carefully. Root is almost always MAX, Level 1 is MIN, Level 2 is MAX. Taking $\min$ at a MAX layer inverts the entire tree.

08. Complete University Question Bank (All Past PYQs Solved)

May 2025 · Question 4.i SEND + MORE = MONEY Cryptarithmetic Resolution (10 Marks)
Question Statement:
Solve the following crypt arithmetic problem step-by-step. Find the value of $N + E + E + D$ if:
$$\begin{matrix} & S & E & N & D \\ + & M & O & R & E \\ \hline M & O & N & E & Y \end{matrix}$$

Solution:

1. Step-by-Step Deduction:
  • Deduce $M = 1$: Column 5 is the carry from Column 4 ($S + M + C_3$). The maximum sum of two single digits plus carry is $9 + 9 + 1 = 19$, so carry $C_4$ can only be $1$. Thus, $\mathbf{M = 1}$.
  • Deduce $O = 0$: In Column 4, $S + 1 + C_3 = 10 \cdot C_4 + O = 10 + O$. Since $S \le 9$, $S + 1 + C_3 \le 11$. $O$ cannot be $1$ (already taken by $M$). Therefore, $\mathbf{O = 0}$.
  • Deduce $S = 9$: With $O = 0$, $S + 1 + C_3 = 10 \implies S + C_3 = 9$. If $C_3 = 1$, $S = 8$. But if $S = 8$, Column 3 would require a carry $C_3 = 1$ from $E + 0 = N$, which is impossible because $E \neq N$ means $E + C_2 = N \le 9$, so $C_3 = 0$. Therefore, $C_3 = 0$ and $\mathbf{S = 9}$.
  • Deduce $C_2 = 1$ and $N = E + 1$: In Column 3, $E + 0 + C_2 = N$. Since all letters are distinct, $E \neq N$, so carry $C_2$ must be $1$. Hence, $\mathbf{N = E + 1}$.
  • Deduce $R = 8$ and $E = 5$: In Column 2, $N + R + C_1 = E + 10 \cdot C_2 = E + 10$. Substitute $N = E + 1$: $$(E + 1) + R + C_1 = E + 10 \implies R + C_1 = 9$$ Since $S = 9$ is already assigned, $R$ cannot be $9$. Thus $C_1$ must be $1$, which forces $\mathbf{R = 8}$.
  • Deduce $D, E, Y$: In Column 1, $D + E = Y + 10$. Remaining unassigned digits: $\{2, 3, 4, 5, 6, 7\}$. To produce a carry $C_1 = 1$, $D + E \ge 12$. If $E = 5$, then $N = E + 1 = 6$. Then $D + 5 = Y + 10 \implies D - Y = 5$. From remaining digits $\{2, 3, 4, 7\}$, the only pair with difference 5 is $D = 7, Y = 2$. Therefore, $\mathbf{D = 7, \ Y = 2, \ E = 5, \ N = 6}$.
2. Arithmetic Verification:
9567
+1085
10652

$9567 + 1085 = 10652 \quad \checkmark \text{ Exact Match!}$

3. Calculation of Target Expression:
$$\mathbf{N + E + E + D = 6 + 5 + 5 + 7 = 23}$$

Final Answer: $\mathbf{23}$

Nov 2025 · Question 5.b Minimax Game Tree Resolution (10 Marks)
Question Statement:
Consider a 3-level game tree where Root A is MAX, Level 1 (B, C) is MIN, Level 2 (D, E, F, G) is MAX.
Leaves under D: 3, 5 | Leaves under E: 6, 9
Leaves under F: 1, 2 | Leaves under G: 0, -1
Determine optimal value for root node A and identify optimal move for MAX. (10 Marks)
Level 0 (MAX): A = ? / \ Level 1 (MIN): B C / \ / \ Level 2 (MAX): D E F G / \ / \ / \ / \ Level 3 (Leaves): 3 5 6 9 1 2 0 -1

Solution:

1. Bottom-Up Evaluation (Level 2: MAX Nodes)
  • $\text{Value}(D) = \max(3, 5) = \mathbf{5}$
  • $\text{Value}(E) = \max(6, 9) = \mathbf{9}$
  • $\text{Value}(F) = \max(1, 2) = \mathbf{2}$
  • $\text{Value}(G) = \max(0, -1) = \mathbf{0}$
2. Evaluation at Level 1 (MIN Nodes)
  • $\text{Value}(B) = \min(\text{Value}(D), \text{Value}(E)) = \min(5, 9) = \mathbf{5}$
  • $\text{Value}(C) = \min(\text{Value}(F), \text{Value}(G)) = \min(2, 0) = \mathbf{0}$
3. Evaluation at Root (Level 0: MAX Node A)
$$\text{Value}(A) = \max(\text{Value}(B), \text{Value}(C)) = \max(5, 0) = \mathbf{5}$$
Final Decision:
  • Optimal Value for Root Node A: $\mathbf{5}$
  • Optimal Move for MAX Player: Move to **Node B** (guarantees a payoff of at least 5).
Nov 2025 · Question 5.a Procedural Alpha-Beta Pruning Walkthrough (10 Marks)
Question Statement:
Explain in detail the procedure of Alpha-Beta pruning applied to a Minimax search tree using an example tree of your choice. Clearly indicate the order of node evaluation, alpha and beta values at each step, and nodes pruned. (10 Marks)

Solution:

1. Concrete Example Tree:

Root MAX has Left Child (MIN) and Right Child (MIN). Left child has leaves $\{4, 7\}$. Right child has leaves $\{2, 8\}$.

2. Traversal Trace with $[\alpha, \beta]$ Intervals:
  1. Root Node: Initialized with $\alpha = -\infty, \beta = +\infty$. Calls Left Child (MIN).
  2. Left MIN Node: Inherits $\alpha = -\infty, \beta = +\infty$.
    • Evaluates first leaf $4$: $v = \min(+\infty, 4) = 4$. Updates $\beta = \min(+\infty, 4) = 4$.
    • Evaluates second leaf $7$: $v = \min(4, 7) = 4$. Updates $\beta = 4$.
    • Returns value $4$ to Root.
  3. Back at Root MAX:
    • Updates $v = \max(-\infty, 4) = 4$.
    • Updates $\alpha = \max(-\infty, 4) = \mathbf{4}$.
    • Calls Right Child (MIN) passing $\boldsymbol{\alpha = 4, \beta = +\infty}$.
  4. Right MIN Node:
    • Evaluates first leaf $2$: $v = \min(+\infty, 2) = 2$. Updates $\beta = \min(+\infty, 2) = \mathbf{2}$.
    • Test Pruning Invariant: Is $\alpha \ge \beta$? $$\alpha = 4 \ge \beta = 2 \quad \implies \mathbf{\text{PRUNE!}}$$
    • Result: Branch to leaf $8$ is never evaluated / pruned! MIN returns $2$ to Root.
  5. Root MAX Final Decision: $\max(4, 2) = \mathbf{4}$. Optimal move is Left.
May 2025 · Question 4.ii Alpha-Beta Pruning on 3-Ply 11-Leaf Tree (10 Marks)
Question Statement:
Find the pruned part of the search tree given below using Alpha-Beta Pruning:
Level 0 (MAX): A
Level 1 (MIN): B, C, D
Level 2 (MAX): E(2, 3), F(5, 9), G(0), H(7, 4), I(2, 1), J(5, 6)

Solution:

1. Subtree under Node B (MIN):
  • Node E (MAX): $\max(2, 3) = 3 \implies \beta_B = 3$.
  • Node F (MAX): Evaluates leaf $5$. Since $5 > 3$, at node B, $\beta = 3 \le \alpha_F = 5 \implies$ **Leaf 9 is PRUNED**!
  • Value of Node B = $3$. Root A updates $\alpha = 3$.
2. Subtree under Node C (MIN) with $\alpha = 3$:
  • Node G (MAX): Evaluates leaf $0 \implies \text{Value}(G) = 0$. Node C updates $\beta = \min(+\infty, 0) = 0$.
  • Now at Node C: $\alpha = 3 \ge \beta = 0 \implies$ **Entire Subtree under Node H (Leaves 7 and 4) is PRUNED**!
3. Subtree under Node D (MIN) with $\alpha = 3$:
  • Node I (MAX): $\max(2, 1) = 2 \implies$ Node D updates $\beta = 2$.
  • Now at Node D: $\alpha = 3 \ge \beta = 2 \implies$ **Entire Subtree under Node J (Leaves 5 and 6) is PRUNED**!
Summary of Pruned Nodes:

$\mathbf{\text{Pruned Nodes: Leaf 9, Entire Node H (Leaves 7, 4), and Entire Node J (Leaves 5, 6)}}$.

Alpha-Beta pruning evaluated only 6 out of 11 leaves, cutting search effort by nearly $50\%$.

09. Interactive Offline Minimax Tree Simulator

Simulate a 2-ply Minimax game tree. Enter candidate leaf values to instantly calculate bottom-up node evaluations and find the optimal root move.

Click button to compute game tree solution.

10. Active Recall Self-Test Quiz

Answer the questions below to evaluate progress (0/4 answered).
1. In Alpha-Beta pruning, what condition triggers a branch cutoff?
Correct: (c) When $\alpha \ge \beta$, the opponent can already force a worse outcome for the player elsewhere, making the current branch irrelevant.
2. In the cryptarithmetic puzzle SEND + MORE = MONEY, what is the value of the leading carry letter M?
Correct: (b) Because $S + M + C_3 \le 9 + 9 + 1 = 19$, the carry $C_4 = M$ must strictly equal $1$.
3. In the May 2025 exam question, what is the calculated value of $N + E + E + D$?
Correct: (a) With $N = 6, E = 5, D = 7$, we have $6 + 5 + 5 + 7 = \mathbf{23}$.
4. In the November 2025 Minimax exam tree with 8 leaves, what is the optimal root value and move for MAX?
Correct: (b) Bottom-up evaluation yields $B = \min(5, 9) = 5$ and $C = \min(2, 0) = 0$. MAX chooses $\max(5, 0) = \mathbf{5}$ by moving to **Node B**.

11. Exam Hall Answer Sheet Presentation Checklist

1. Draw the Game Tree with Labeled Level Roles

Write explicitly beside the tree: Level 0 (MAX), Level 1 (MIN), Level 2 (MAX).

2. Show Bottom-Up Evaluation Equations Level by Level

Write $D = \max(3, 5) = 5$, then $B = \min(5, 9) = 5$, then $A = \max(5, 0) = 5$.

3. State Both Root Value and Move Direction

Box the answer: "Optimal Root Value = 5; Optimal Move = Move to Node B."

4. For Cryptarithmetic, Write Down Carry Variables ($C_1, C_2, C_3, C_4$)

Set up column equations with carry bits explicitly before solving.

5. Show Final Substitution Grid for Verification

Write $9567 + 1085 = 10652$ with checkmark to prove correctness.