# Instant runoff-voting ## Say no to strategic voting Instant-runoff voting is an alternative voting scheme used in some contries such as Australia, for example. At a certain moment in time, it was used in Canada as well. The objective is to choose one candidate from a pool of candidates. Voters rank their candidates in the order of preference. In the variant we describe for the hackathon, voters rank all of the candidates, with the candidate ranked 1 as the most preferred one. Voting takes place in rounds. The candidate with the least votes in a round is eliminated from the competition. The ballots that suported the candidate who was eliminated are examined for their next choice, and the new votes are redistributed to the remaining candidates. The voting continues until a single candidate is left who is declared the winner of the election. Suppose there are k candidates to choose from and n voters. Each voter ranks all of the k candidates according to their preference, with rank 1 being the most preferred candidate. Initialization: all n ballots are counted by examining position p=1 on each ballot. Each ballot thus supports the candidate on position p=1 on the ballot. We call this position the "current position" on the ballot. Termination: If there is a candidate with the majority of votes (more than n/2), then the candidate is declared the winner. If there is no winner, we proceed with Round i (i=1 initially). Round i: The candidate with the fewest votes is eliminated from the race. Suppose this is candidate k. Let $V_k$ be the set of ballots who voted for candidate k.  The ballots in set V_k are re-examined and the votes correspondig to the next preference are redistributed among the remaining candidates. More precisely, let B be a ballot from set V_k for which the current position is p. This means that candidate k who was just eliminated is at position p. The candidate at position p+1 on the ballot receives now the vote from ballot B. We now test for termination and if no winner is declared, we continue with Round i+1. HACKATHON CHALLENGE: write a system of smart contracts that implement the instant-runoff voting. For simplicity, break any ties arbitrarily. RESOURCES https://en.wikipedia.org/wiki/Instant-runoff_voting