Skip to content

jimjenkins5/vote-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published