Back to Learning Area

Agents in Conflict — Game Theory

What a second rational player changes about an optimization — everything.

  • Concepts
  • 10 min
  • Intermediate

Plain Language

This preview is in Plain Language. The whole portal is also available in Plain Language. You can change the language at the top. Or use the button below. Our Plain Language texts are AI-assisted and editorially reviewed. They follow the core principles of easy-to-read language, but they are not certified Easy Read: a review panel of people with learning difficulties does not test them.

Preview: When AI plays against AI

What is game theory?

Game theory is a science. It examines decisions between multiple players. This means: every player wants the best result. Other players also want to win. AI agents are AI programs. They use game theory.

The zero-sum game

A zero-sum game is a competition. One wins, one loses. An example is rock-paper-scissors. You win a point. At the same time, the opponent loses a point. Gains and losses add up to zero.

The Nash equilibrium

All players stick to their strategy. Then nothing changes anymore. This is called the Nash equilibrium. The prisoner's dilemma is a famous example. Both prisoners betray each other. But silent cooperation would be better for both.

Your search agent (like the A* algorithm from the previous article) found the optimal path through the maze. But what happens when someone on the other side is actively rearranging the walls? The moment a second intelligent agent enters the picture — one with goals that directly oppose yours — everything changes.

This chapter shows why the jump from a single agent to a multi-agent system is not simply "more of the same" but a fundamental paradigm shift. Game theory provides the mathematical toolkit for this transformation — and it is the foundation upon which all adversarial AI algorithms are built.

From Solo to Duel — Multi-Agent Systems

In the previous articles, your agent always worked against a static environment: a maze, a road network, a puzzle. The environment had no goals of its own. Now that changes fundamentally.

Definition

Multi-Agent System

Analogy

Driving alone on an empty highway is a single-agent problem — you optimize your route against the static road network. Playing chess is an adversarial two-agent problem — your opponent actively works to block your plans and set traps. Rush-hour traffic is a complex multi-agent system where thousands of drivers with mixed interests (some cooperative, some competitive) interact simultaneously.

Example

In chess, the opponent's moves are fully visible (perfect information). In real traffic, you cannot see every driver's intentions (imperfect information). The analogy correctly captures this gradation but simplifies: with thousands of agents instead of two, traffic cannot be calculated out like a game of chess.
Single Agent (e.g. A* in a maze)

Static environment. No counter-moves. The optimal path remains stable. Pure optimization.

Multi-Agent (e.g. chess game)

Dynamic environment. The opponent responds intelligently. Every move changes the situation. Strategic thinking required.

Legal positions in Tic-Tac-Toe: A computer solves the game in milliseconds

5,478

Legal positions in chess: Exhaustive analysis impossible — heuristics required

~10 ⁴⁴

Tic-Tac-Toe has only 9 squares yet 5,478 legal game positions. Because this state space is tiny by computational standards, a computer can exhaustively analyze every possible game in milliseconds and compute a mathematically perfect strategy (the game is "solved"). Chess, by contrast, has approximately 10⁴⁴ legal positions — exhaustive analysis is impossible, which is why chess engines need heuristic strategies.

Caution

Misconception: An opponent just makes the search tree bigger

It is not about size. The fundamental NATURE of the problem changes. In single-agent search, the environment is passive. In adversarial search, the "environment" actively works against you. You cannot simply find the best path — you must find the best path assuming the opponent plays optimally against you. This is a qualitative shift, not a quantitative one.

Zero-Sum Games — The Fixed Pie

Now that you understand the paradigm shift, we need a mathematical model for pure competition. The zero-sum game is that model: what one player gains, the other loses — exactly.

Definition

Zero-Sum Game

Analogy

Imagine one cake on a table shared between two people. Whatever you take, I lose. The cake never grows. If you get 70%, I get 30%. The total is always 100%: whatever you get beyond half (+20 percentage points) is missing from my share (−20), so gain and loss cancel out to zero. That is a zero-sum game. But in real economics, the "cake" can grow — two businesses partnering might create a bigger cake for both (positive-sum game).

Example

A real cake can be enjoyed differently by different people (you prefer the frosting, I prefer the sponge) — utility is subjective. In the mathematical model, payoffs are assumed to be objective numerical values on a common scale. This simplification is what makes the math tractable.

Payoff Matrix: Rock-Paper-Scissors

Consider the 3×3 payoff matrix from Player 1's perspective (row) against Player 2 (column):

Player 1 / Player 2RockPaperScissors
Rock0−1+1
Paper+10−1
Scissors−1+10

Each cell shows Player 1's payoff. Player 2 receives the negative value (zero-sum). Reading the matrix: Rock beats Scissors (+1), loses to Paper (-1). Key insight: the optimal strategy is to play each option with exactly 1/3 probability (mixed strategy). Any deviation — even slightly favoring Rock — is exploitable by an observant opponent.

If you play a non-uniform strategy in Rock-Paper-Scissors — say 34% Rock, 33% Paper, 33% Scissors — an observant opponent can detect the pattern and play Paper more often. Any deviation from 1/3 per option gives the opponent exploitable information. That is why the optimal strategy is strictly uniform: maximum unpredictability.

Caution

Misconception: Every competitive situation is zero-sum

Most real-world competition is NOT zero-sum. Business competition often expands markets (positive-sum). International trade creates mutual benefits. Even in some games, cooperation can improve outcomes for all players (see Nash Equilibrium and the Prisoner's Dilemma). The zero-sum assumption is a deliberate simplification for mathematical tractability, not a universal law.

Nash Equilibrium — When Nobody Can Do Better

You now know zero-sum games and payoff matrices. But how do you find a "good" strategy? John Nash provided the answer in 1950: the equilibrium where no player can unilaterally improve.

Definition

Nash Equilibrium

Analogy

Two restaurants sit side by side on the same street. Each sets its lunch price. Over time, both have optimized their prices so that any unilateral change would make them worse off. Raising the price loses customers to the neighbor; lowering it cuts margins below viability. They have reached a Nash equilibrium. Neither restaurant is thrilled with the outcome, but neither can unilaterally improve it.

Example

Real restaurants can differentiate (cuisine type, ambiance, service), creating a multi-dimensional competition that the simple pricing model does not capture. Also, real businesses can collude (illegal in many jurisdictions). The Nash model describes non-cooperative games, in which binding agreements are ruled out.

The Prisoner's Dilemma — Stability Without Optimality

The most famous game in game theory. Two suspects are interrogated separately. Each can either Cooperate (stay silent) or Defect (betray the other). Note: Here the payoffs are measured in years of imprisonment — less is better, unlike Rock-Paper-Scissors.

  1. 1. SetupTwo suspects, interrogated separately. Each has two options: Cooperate (stay silent) or Defect (betray the other).
  2. 2. PayoffsBoth cooperate: 1 year each. One defects, the other cooperates: defector goes free, cooperator gets 6 years. Both defect: 3 years each.
  3. 3. Dominant StrategyNo matter what the other does: Defecting is always better. If the other cooperates? Defecting gives 0 instead of 1 year. If the other defects? Defecting gives 3 instead of 6 years.
  4. 4. The ParadoxThe Nash equilibrium is (Defect, Defect) with 3 years each — even though (Cooperate, Cooperate) with 1 year each would be better for BOTH. Stability is not optimality.
Player 1 / Player 2CooperateDefect
Cooperate1 / 1 years6 / 0 years
Defect0 / 6 years3 / 3 years

Each cell: years in prison for player 1 (row) / player 2 (column). Green: best for both. Orange: the Nash equilibrium. The Nash equilibrium of the Prisoner's Dilemma is (Defect, Defect) because Defecting is the dominant strategy for both players: regardless of what the other does, Defecting is always the better choice. Yet mutual cooperation (1 year instead of 3) would benefit both. The equilibrium is stable but collectively suboptimal — a key result of game theory.

Caution

Misconception: Nash equilibrium is the best outcome

The Prisoner's Dilemma proves exactly the opposite. The Nash equilibrium (mutual betrayal, 3 years each) is WORSE for both players than mutual cooperation (1 year each). A Nash equilibrium guarantees stability (nobody can improve alone), not optimality (best possible result). This distinction is fundamental for AI agent design: agents that blindly optimize individually can produce collectively worse outcomes.

Interactive: Where Is the Nash Equilibrium?

Choose Cooperate or Defect for both suspects — with the buttons or directly in the table. The box shows the years in prison and checks, for each player, whether switching alone would get them fewer years. Where that holds for neither player, you have found the Nash equilibrium; it is marked in the table.

Mathematical game theory was founded in 1944 by John von Neumann and Oskar Morgenstern in their work "Theory of Games and Economic Behavior." They formalized zero-sum games; von Neumann had already proved the Minimax theorem for them in 1928. Six years later, in 1950, mathematician John Nash decisively expanded the field in his PhD dissertation at Princeton University: he proved that every finite game — not just zero-sum games — has at least one equilibrium. For this contribution, Nash received the 1994 Nobel Prize in Economics (shared with John Harsanyi and Reinhard Selten). Game theory is now a cornerstone of AI research: from the MinMax algorithm (next article) to multi-agent reinforcement learning to automated auction systems.

Note

Key Takeaways

  • A second intelligent agent transforms optimization into strategic reasoning — you must anticipate the opponent's response to every move you make.
  • In a zero-sum game, gains and losses always sum to zero (the "fixed pie"). Payoff matrices make all possible outcomes visible and analyzable.
  • A Nash equilibrium is a stable state where no player can improve by unilaterally changing strategy — but stability does not guarantee optimality (the Prisoner's Dilemma proves it).

Check Your Understanding

Can you explain this in your own words? Tick what you've got.

0 of 3 done

Check

Quiz: Game Theory

Not completed

A robot navigates a warehouse alone, avoiding static obstacles. A second robot is introduced that competes for the same pickup locations. What fundamentally changes about the first robot's planning problem?

Select one answer

Answer Key: 1) B · 2) B · 3) B · 4) B