Fundamentals 14 min read

Byzantine Generals Problem Illustrated with Three Kingdoms Card Game

This article uses the popular Chinese card game Three Kingdoms to illustrate the Byzantine Generals Problem, explaining its relevance to distributed consensus, outlining four foundational theories and eight protocols, and demonstrating how voting, message tampering, and signature mechanisms affect agreement among nodes.

Wukong Talks Architecture
Wukong Talks Architecture
Wukong Talks Architecture
Byzantine Generals Problem Illustrated with Three Kingdoms Card Game

Preface

Three Kingdoms is a popular Chinese card game that combines the Three Kingdoms historical background with role‑based cards, suitable for all ages.

Before the explanation we first discuss the overall context of distributed protocols and algorithms.

Many developers are familiar with the CAP and BASE theories, but few actually study distributed algorithms in depth for three main reasons: the perceived complexity, the lack of plain‑language resources, and the absence of a clear learning roadmap.

Concern that the algorithm is too complex, so little time is spent.

Few resources explain distributed algorithms in simple language.

No clear learning path for distributed algorithms.

Future articles will use stories and plain language to explain the principles of distributed algorithms and the learning route.

Learning Path

The learning route for distributed protocols and algorithms starts with four fundamental theories as a foundation, then proceeds to distributed protocols and algorithms, similar to building a house on a solid foundation.

Four Fundamental Theories

Byzantine Generals Problem

CAP Theory

ACID Theory

BASE Theory

Eight Distributed Protocols and Algorithms

Paxos Algorithm

Raft Algorithm

Consistent Hashing Algorithm

Gossip Protocol Algorithm

Quorum NWR Algorithm

FBFT Algorithm

PoW Algorithm

ZAB Protocol

Because of length constraints, this article only covers the Byzantine Generals Problem.

Byzantine Generals Problem

The problem, originally proposed by Leslie Lamport, describes a scenario where generals must reach consensus despite possible traitors and spies.

In the Byzantine Empire (modern Istanbul), generals and deputies must agree on a unified battle plan. Traitors and spies can send misleading messages, creating a Byzantine fault scenario.

Understanding this problem provides insight into distributed consensus and helps choose or design appropriate algorithms.

It is the first fundamental theory because it abstracts the consensus challenge faced by distributed systems.

Three Kingdoms Identity Cards

Three Kingdoms defines four roles: Monarch, Loyalist, Rebel, and Spy. Each player receives a role card with specific win conditions and tactics.

Monarch

Win condition: eliminate all rebels and the spy.

Strategy: survive first, distract rebels, and cooperate with loyalists.

Loyalist

Win condition: protect the monarch while eliminating rebels and the spy.

Strategy: act as a shield for the monarch.

Rebel

Win condition: eliminate the monarch.

Strategy: concentrate attacks on the monarch.

Spy

Win condition: eliminate rebels and loyalists first, then duel the monarch as the last survivor.

Strategy: combine tactics, calm mind, and luck.

Mapping to Distributed Systems

Generals correspond to computer nodes.

Loyalist generals correspond to correctly operating nodes.

Traitor generals correspond to faulty nodes that send misleading information.

Killed messengers correspond to communication failures or message loss.

Spies replacing messengers correspond to malicious attacks, forged messages, or hijacked communication.

The Byzantine Generals Problem is the most complex fault model in distributed systems and is used in blockchain technology, requiring Byzantine Fault Tolerance ( BFT ).

Non‑Byzantine fault tolerance ( CFT ) assumes no malicious nodes and is solved by algorithms such as Paxos, Raft, and ZAB.

Solution Overview

One solution adds an extra loyal commander (e.g., Yuan Shao) to increase the number of loyal nodes, allowing a majority vote to achieve consensus.

The process involves two rounds of communication: the commander sends a plan to all deputies, and each deputy forwards the received plan to the others. Majority voting then determines the final action.

Even if a deputy acts as a malicious spy, the presence of a trustworthy commander can prevent inconsistent decisions.

Signature‑Based Solution

An alternative solution uses signed messages (e.g., seals or tokens) to ensure authenticity: signatures cannot be forged, and anyone can verify them.

Details are omitted for brevity.

Conclusion

By using Three Kingdoms roles to illustrate distributed consensus scenarios, we map game elements to distributed system concepts and show how Byzantine fault tolerance, signature mechanisms, and voting protocols can achieve reliable agreement.

AlgorithmByzantine fault tolerancethree kingdoms
Wukong Talks Architecture
Written by

Wukong Talks Architecture

Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.