@@ 20,7 20,7 @@ Example
Using the example data in the repository:
```
-10235(hg:default)» go run main.go < input-1.csv ~/workspace/sbb
+10235(hg:default)» go run main.go < input-1.csv
Total votes in input: 15
Summary of distributions
# A B C
@@ 80,8 80,14 @@ go get hg.sr.ht/~ser/MARS
```
You'll get a program called `MARS` in your `$GOPATH/bin`, usually
-`~/go/bin`. Alternatively, check out the repository and run it on the
-command line:
+`~/go/bin`. Compiled or downloaded, you would then either download an input
+file from the repository, or create your own, and run it with:
+
+```
+MARS < inputdataset.csv
+```
+
+Alternatively, check out the repository and run it on the command line:
```
hg clone https://hg.sr.ht/~ser/MARS
@@ 1,6 1,6 @@
package main
-// score-better-balance calculator
+// MARS (Mixed Absolute Relative Score)
// from https://www.reddit.com/r/EndFPTP/comments/lil4zz/scorebetterbalance_a_proposal_to_fix_some/
import (
@@ 12,6 12,7 @@ import (
"strings"
)
+// FIXME: detect tie
func main() {
/**************************/
/* Process the input data */
@@ 64,11 65,12 @@ func main() {
// then we're looping; dump the cycle list and exit.
for _, cand := range past {
if w2 == cand {
- fmt.Print("Cycle found in ")
+ fmt.Print("Cycle found in adjusted scoring ")
for _, c := range past {
fmt.Printf("%s => ", lines[0][c])
}
fmt.Printf("%s => ...\n", lines[0][w2])
+ printScoreDetails(w, lines, badVotes, ints, diffs, ttl)
return
}
}
@@ 78,7 80,8 @@ func main() {
wc = w2
}
- printDetails(wc, lines, badVotes, ints, diffs, ttl)
+ printScoreDetails(wc, lines, badVotes, ints, diffs, ttl)
+ printAdjustDetails(wc, lines, badVotes, ints, diffs, ttl)
}
// getRange finds the maximum and minimum score values in the entire file.
@@ 191,7 194,7 @@ func total(lines [][]int, diffs [][]int)
// printDetails cut out from main() to keep main terse; nothing here is
// relevant to the voting calculation, and is only output.
-func printDetails(wc int, hlines, badVotes [][]string, ints [][]int, diffs [][]int, ttl []int) {
+func printScoreDetails(wc int, hlines, badVotes [][]string, ints [][]int, diffs [][]int, ttl []int) {
header := hlines[0]
lines := hlines[1:]
// The rest of this is just dumping out the calculations.
@@ 201,6 204,10 @@ func printDetails(wc int, hlines, badVot
printWithCandidates("Subtotals", false, header, subttl)
subWc := max(subttl)
fmt.Printf("Winner by score: %s with %d\n", header[subWc], subttl[subWc])
+}
+
+func printAdjustDetails(wc int, hlines, badVotes [][]string, ints [][]int, diffs [][]int, ttl []int) {
+ header := hlines[0]
printWithCandidates("Summary of diffs", true, header, uniq(toString(diffs)))
printWithCandidates("Modifiers", false, header, subtotal(diffs))
printWithCandidates("Totals", false, header, ttl)
@@ 0,0 1,9 @@
+A,B,C
+5,1,0
+5,1,0
+5,1,0
+5,1,0
+0,1,5
+0,1,5
+0,1,5
+0,1,5