Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 712 Bytes

README.md

File metadata and controls

35 lines (26 loc) · 712 Bytes

Borda Vote Counter

What?

This small script takes a json file of ballots and determines the winner using the Borda method.

How do I use it?

npx borda-vote-counter /path/to/votes.json

Format of votes.json.

The JSON file should be an array of ballot arrays. The first item in each ballot is the preferred option, the last is the least preferred option.

[
  [ "OB", "SL" ],
  [ "SL", "CL", "OB", "SB" ],
  [ "OB", "SL", "SB", "CL", "TR" ],
  [ "SL", "SB", "TR", "CL", "OB" ],
  [ "OB" ],
  [ "OB", "SB", "SL" ],
  [ "TR", "CL", "SL", "OB" ],
  [ "SB", "CL", "OB" ]
]

The above json file will result in the following output:

WINNER { option: 'OB', value: 21 }