larryhastings / starvote Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Bug similar to issue 8 - starvote
File ‘example.py’
import starvote
ballots = [
{'Amy': 1, 'Amy': 2},
]
winners = starvote.election(starvote.star, ballots, verbosity=1)
[STAR Voting]
Tabulating 1 ballots.
Maximum score is 5.
[STAR Voting: Scoring Round]
The two highest-scoring candidates advance to the next round.
Only one candidate, they win.
[STAR Voting: Winner]
A
Problem:
==
#8 - similar issue has been resolved here:
Issue number has been fixed - this works fine now ( we get expected error)
[options]
method = star
verbosity = 1
[ballots]
5 ballots:
Amy = 3
Amy = 2
Expected error message is raised - great!:
“specified candidate 'Amy' twice on one ballot”
I would suggest for readability to re-organize the init.py file by moving distinct portions into other files.
Specifically:
measure_int_or_fraction_as_str
)There are probably other ways the code could be segmented out into purpose built files, but this is my quick suggestion.
I attempted to make the verbose output both machine-readable text and human-readable text, and currently it's not very good at being either.
The proper solution here: the output from the algorithm should be designed around human readability, and then there should be a "formatter" that reformats it for humans.
Probably there should be a "preformatter" that turns the terse output of the algorithm into human-readable text, and then one "formatter" for monospaced text output, one for HTML, one for Markdown, etc.
It would shorten the output if the randomised tiebreak order section was omitted unless that specific case comes up.
We get incorrect error message:
KeyError("'A'")
Instead of:
How to reproduce the issue:
[options]
method = sss
seats = 5
tiebreaker = None
verbosity = 1
[ballots]
2 ballots:
A=5
B=4
C=0
D=0
A=0
B=4
C=0
D=5
[options]
method = star
tiebreaker = none
verbosity = 1
[ballots]
Andre = 5
Blake = 5
Carmen = 5
Andre = 3
Blake = 3
Carmen = 3
Andre = 4
Blake = 4
Carmen = 4
[STAR Voting]
Tabulating 3 ballots.
Maximum score is 5.
[STAR Voting: Scoring Round]
The two highest-scoring candidates advance to the next round.
Andre -- 12 (average 4) -- Tied for first place
Blake -- 12 (average 4) -- Tied for first place
Carmen -- 12 (average 4) -- Tied for first place
There's a three-way tie for first.
[STAR Voting: Scoring Round: First tiebreaker]
The two candidates preferred in the most head-to-head matchups advance.
Andre -- 0 -- Tied for first place
Blake -- 0 -- Tied for first place
Carmen -- 0 -- Tied for first place
No Preference -- 9
There's still a three-way tie for first.
[STAR Voting: Scoring Round: Second tiebreaker]
The two candidates with the most votes of score 5 advance.
Andre -- 1 -- Tied for first place
Blake -- 1 -- Tied for first place
Carmen -- 1 -- Tied for first place
There's still a three-way tie for first.
[STAR Voting: Scoring Round: Unbreakable Tie]
Tie between Andre, Blake, and Carmen.
It would make it more readable if the printed output had blank lines to make it easier to distinguish the sections.
Readability is important as not everyone will be familiar with the process of tallying under STAR voting.
Alternatively or additionally, it might be cute if it produced valid Markdown which could be rendered as HTML...
[options]
method = star
tiebreaker = none
verbosity = 1
[ballots]
Andre = 3
Andre = 1
Blake = 0
Carmen = 0
Blake = 0
Carmen = 0
Andre = 0
Blake = 0
Carmen = 0
[STAR Voting]
Tabulating 3 ballots.
Maximum score is 5.
[STAR Voting: Scoring Round]
The two highest-scoring candidates advance to the next round.
Andre -- 1 (average 1/3) -- First place
Blake -- 0 (average 0) -- Tied for second place
Carmen -- 0 (average 0) -- Tied for second place
Andre advances, but there's a two-way tie for second.
[STAR Voting: Scoring Round: First tiebreaker]
The candidate preferred in the most head-to-head matchups advances.
Blake -- 0 -- Tied for second place
Carmen -- 0 -- Tied for second place
No Preference -- 3
There's still a two-way tie for second.
[STAR Voting: Scoring Round: Second tiebreaker]
The candidate with the most votes of score 5 advances.
Blake -- 0 -- Tied for second place
Carmen -- 0 -- Tied for second place
There's still a two-way tie for second.
[STAR Voting: Scoring Round: Unbreakable Tie]
Tie between Blake and Carmen.
See details in video: https://youtu.be/CYB-DoGJ1YY
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.