The Venetian election system was... complicated.
The Great Council came together and put in an urn the ballots of all the councilors who were older than 30. The youngest councilor went to St Mark's Square and chose the first boy he met who drew from the urn a ballot for each councillor and only those 30 who got the word ‘elector' remained in the room. The 30 ballots were then placed back in the box and only 9 contained a ticket, so the 30 were reduced to 9, who gathered in a sort of conclave, during which, with the favourable vote of at least seven of them, they had to indicate the name of 40 councillors.
With the system of ballots containing a ticket, the 40 were reduced to 12; these, with the favourable vote of at least 9 of them, elected 25 others, which were reduced again to 9 who would elect another 45 with at least 7 votes in favour. The 45, again at random, were reduced to 11, who with at least nine votes in favour elected another 41 that finally would be the real electors of Doge.
These 41 gathered in a special room where each one cast a piece of paper into an urn with a name. One of them was extracted at random. Voters could then make their objections, if any, and charges against the chosen one, who was then called to respond and provide any justification. After listening to him, they preceded to a new election, if the candidate obtained the favourable vote of at least 25 votes out of 41, he was proclaimed Doge, if they were unable to obtain these votes a new extraction took place until the outcome was positive.
Venice is no longer an independent republic, but if they were, they would be dying to automate this system! (because we all know electronic voting is the future!) Time for you to step in. To streamline the democracy, I've made a few assumptions on voter preference, group sizes, picking logic, etc. Your program is to do the following.
- Here is the list of members of the Great Council (who are all older than 30). Take this as input, by perhaps reading it from a file, or whatever you prefer. The number of councillors varied over time, so your program should not depend on the number of people.
- Take the youngest member of the council. Because there are no ages given, you'll have to guess. Pick a person at random, and print their name.
- The boy at the square will pick thirty members from an urn. So, randomly choose 30 people from the list (not including the youngest councillor). Print all their names.
- Of those thirty, nine are randomly selected to go to the next round. So randomly choose 9 from that group, and print their names.
- Those nine electors have to choose forty different councillors. So, from the list of councillors, excluding the electors (but including the twenty-one people from the previous round of thirty who did not become electors), pick 40 members. Print their names.
- The forty were reduced to twelve by lot. Pick 12 from these members at random, print their names.
- The dozen elected twenty-five councillors. You know the rules by now: pick 25 councillors excluding the 12 (but including anyone not in the 12 who partook in previous rounds), and print their names.
- The twenty-five got reduced to nine again. Pick 9 random people from the 25 and print their names.
- Those nine selected forty-five councillors. Pick 45 people not in the 9, and print their names.
- The forty-five were reduced to eleven. Pick 11 random councillors from those 45, and print their names.
- The eleven picked forty-one councillors who would elect the doge. Pick 41 people not in the 11, print their names.
- Finally, these people will elect the Doge of Venice. Pick 1 person, randomly, from the 41. Then print their name. And then you can rest and watch the sun set on a democratic universe.
This horrendously complicated system was made to reduce corruption; so however you implement it, every member of the Great Council must have an equal chance of getting elected in the end.
In tabular form:
Step | From | Pick | New group |
---|---|---|---|
1 | All | 1 | A |
2 | All except A | 30 | B |
3 | B | 9 | C |
4 | All except C | 40 | D |
5 | D | 12 | E |
6 | All except E | 25 | F |
7 | F | 9 | G |
8 | All except G | 45 | H |
9 | H | 11 | I |
10 | All except I | 41 | J |
11 | J | 1 | Doge |
Other rules:
- Print the name(s) exactly as given, with the same capitalisation, etc. There's only going to be readable ascii characters, there's no Nicolò on the council.
- Print every new step of the algorithm on a new line.
- When printing a list of names, separate them in some fashion from one another (not with spaces as the names contain spaces). If you separate them with newlines, then add an extra newline between steps so those remain clearly separated as well.
- This is code-golf, so your score is the number of bytes in your code. Lowest score wins!