Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1.     def election_step(self, candidates_id, candidates_attribute):
  2.                 # If our id is the first id in the list
  3.                 # we have done the full circle and can choose a leader node
  4.         if len(candidates_id) != 0 and candidates_id[0] == str(self.server_id):
  5.             int_attrs = map(int, candidates_attribute)
  6.             win_indx = int_attrs.index(max(int_attrs))
  7.             self.leader = self.vessels[int(candidates_id[win_indx])]
  8.             return None, self.leader
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement