# How Voting Systems Work 9, Exercise 1: dictators, veto holders and dummies # Assumed systems (invented): each is (weights, quota). def roles(weights, quota): n = len(weights) total = sum(weights) out = [] for i in range(n): alone = weights[i] >= quota # wins with nobody else veto = total - weights[i] < quota # the rest cannot reach the quota without i dummy = True # never critical in any winning coalition for mask in range(1 << n): if mask >> i & 1: t = sum(weights[j] for j in range(n) if mask >> j & 1) if t >= quota and t - weights[i] < quota: dummy = False break out.append("dictator" if alone else "veto" if veto else "dummy" if dummy else "ordinary") return out systems = { "one big shareholder": ([51, 25, 24], 51), "unanimity": ([40, 30, 30], 100), "49/48/3 parliament": ([49, 48, 3], 51), "board 9,9,7,3,1,1": ([9, 9, 7, 3, 1, 1], 16), "quota 60 of 100": ([30, 20, 20, 15, 15], 60), } for name, (w, q) in systems.items(): print(f"{name:<20} quota {q:>3}/{sum(w):<3} ->", ", ".join(roles(w, q))) # Output when run: # one big shareholder quota 51/100 -> dictator, dummy, dummy # unanimity quota 100/100 -> veto, veto, veto # 49/48/3 parliament quota 51/100 -> ordinary, ordinary, ordinary # board 9,9,7,3,1,1 quota 16/30 -> ordinary, ordinary, ordinary, dummy, dummy, dummy # quota 60 of 100 quota 60/100 -> ordinary, ordinary, ordinary, ordinary, ordinary