stv voting system written in rust.
Go to file
Adrian Gunnar Lauterer add30f3515
init
2024-03-03 06:11:13 +01:00
src init 2024-03-03 06:11:13 +01:00
.gitignore Initial commit 2024-03-03 03:43:44 +01:00
Cargo.lock init 2024-03-03 06:11:13 +01:00
Cargo.toml init 2024-03-03 06:11:13 +01:00
LICENSE Initial commit 2024-03-03 03:43:44 +01:00
README.md init 2024-03-03 06:11:13 +01:00
flake.nix init 2024-03-03 06:11:13 +01:00
sample.json init 2024-03-03 06:11:13 +01:00

README.md

Vote-rs

This is a simple Rust program that reads a file of voting records and counts the votes for each nominee.

goael

Implement a stv vote counting system in rust. Could be based on rules and information found here: https://www.opavote.com/methods/single-transferable-vote probably implement the scottish method https://www.legislation.gov.uk/ssi/2007/42/contents/made because it is simpler and seems to be ok middle ground between complexity and fairness.

Usage

To run the program, use the following command:

cargo run -- sample.csv --amount 3

Replace sample.csv with the path to your file of voting records. amount is the number of nominees to select from the records.

Functionality

The program reads the voting records from the specified file into a Vec. Each Record contains a Vec, where each Vote has a name and a value.

The get_unique_names function is used to get a Vec of the unique names in the records.

The count_votes function is used to count the votes for each name. It returns a Vec where each Vote has a name and a value that is the total of the votes for that name. The Vec is sorted in descending order by vote value.