Giter Site home page Giter Site logo

starvote's People

Contributors

larryhastings avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

masiarek fsargent

starvote's Issues

Number of Seats cannot be higher than Number of Candidates

We get incorrect error message:
KeyError("'A'")

Instead of:

  • Number of Seats cannot be higher than Number of Candidates.

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

starvote format shouldn't permit specifying the same candidate twice on one ballot

[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.

missing expected error message "specified candidate '...' twice on one ballot"

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:

  • missing expected error message "specified candidate '...' twice on one ballot"

==
#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”

Suggestion: Split the __init__.py into multiple files

I would suggest for readability to re-organize the init.py file by moving distinct portions into other files.
Specifically:

  • each voting method function moved into separately named file/module
  • the helper methods moved into a helpers file/module (such as: measure_int_or_fraction_as_str)
  • tiebreaker classes moved into a separate file

There are probably other ways the code could be segmented out into purpose built files, but this is my quick suggestion.

"No Preference" should be the number of voters who expressed no preference in a round, not the number of head-to-head contests where no preference was expressed in a round

[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.

Add blank lines to output for improved readability

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...

Rewrite output approach

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.