init
This commit is contained in:
30
README.md
30
README.md
@@ -1,3 +1,29 @@
|
||||
# vote-rs
|
||||
# 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:
|
||||
|
||||
```bash
|
||||
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<Record>. Each Record contains a Vec<Vote>, where each Vote has a name and a value.
|
||||
|
||||
The get_unique_names function is used to get a Vec<String> of the unique names in the records.
|
||||
|
||||
The count_votes function is used to count the votes for each name. It returns a Vec<Vote> where each Vote has a name and a value that is the total of the votes for that name. The Vec<Vote> is sorted in descending order by vote value.
|
||||
|
||||
stv voting system written in rust.
|
||||
Reference in New Issue
Block a user