home / about / submit a resource / contact us

Byzantine Generals

Mordechai (Moti) Ben-Ari

Instructions

Recommendation: Your monitor resolution should be at least 800x600.

This famous algorithm is used to demonstrate the implementation of a reliable system in the presence of faults. A loyal general will relay messages exactly as they are received, while a traitorous general may relay a message incorrectly. The goal of the algorithm is for the loyal generals to come to a consensus in the presence of traitors. Three loyal generals can come to a consensus even in the presence of a fourth general who is a traitor.

First, select attack or retreat for each general. Next, relay the chosen plans to each of the other three generals. While this is being done, you may receive the plan of another general; these plans must eventually be relayed to the remaining two generals.

A two-stage majority voting scheme is used. Majority voting (2 out of 3) is used by each general to decide what the true plan of the other generals is. The presence of a single traitor does not affect the outcome of this vote, so each loyal general has an identical picture of the plans chosen by the other two loyal generals. A second stage of majority voting is used to decide what plan to follow.

The applets do not maintain information as to who is a traitor and who is not. You must specify state transitions that are consistent with the algorithm. The applet does keep track of which plans have been sent and received, and the prompt lists will tell you which plans must be sent or relayed. Voting is done automatically.