Namespace AS2.Subroutines.LeaderElectionFast
Classes
SubLeaderElectionFast
Fast leader election subroutine. Uses 4 pins to establish 4 global circuits and transmit all coin toss results in a single round instead of 4. Also skips the first phase because it is unnecessary.
See SubLeaderElection for a more detailed description.
Usage:
- Initialize by calling Init(bool, bool, int). At least one amoebot in the system should be a candidate.
- Setup a pin configuration using SetupPC(PinConfiguration). This only has to be called once and the same pin configuration can be used for the whole duration of the leader election.
- Call ActivateSend() to send the beeps and then call ActivateReceive() in the next round to receive the beeps. Then repeat this until the procedure is finished.
- You can check whether the procedure has finished using IsFinished() and find the elected leader using IsLeader().