Skip to content

Latest commit

 

History

History
83 lines (72 loc) · 3.78 KB

NOTES.md

File metadata and controls

83 lines (72 loc) · 3.78 KB

NOTES.md

Port to DLang of the Apple Pascal Banzhaf Index calculator from the March 1983 issue of Byte Magazine. Mostly intended as a learning project for D.

Notes

open

  • GITHUB integration, run tests on push?
  • --verbose option
  • CSV
    • CSV input not done yet
    • think about other output formats, like CSV
    • is there another tool that can handle the conversion?
      • goAwk
      • true awk
      • recent gawk
  • Proportional mwc calc needs revision and command line switches.
    • Turned off for now
    • --mwc=majority 1/2 + on ties
    • --mwc=NUM
    • --mec=2/3 supermajority. is it > or >=??
    • --mwc=1/1 unaminity we can shortfut the calc.
  • Array of bool is unpacked in bytes.
  • I badly want an assert that lets me specify a POSIX exit code on failure.
    • exitassert(totalVotes < 1, "TotalVotes < 1", EXIT_BADDATA);
  • ./banzdemo --mwc=21 < testinput/Votes-ltext5.banzbyte

closed-ish

  • DONE do easy options: headerX, mwcX, ???
  • DONE Montecarlo
    • WTF is Phobos doing with std.random.uniform() being @gc!?
  • DONE error handling for getopt
    • If we just give up and jusr make the parser @safe it should be easy.
  • DONE Issue warning if monte carlo and mwc == totalVotes (unanimity)?
    • it won't get it right without a lucky hit on the single
    • all will work, but could take a while
    • there is only one coalition that will work, the one that everyone is in. if anyone defects, the vote sill fail. So, everyone has the same NumPivots and totalPivots, which means the same BI.
    • DONE Add a a special case?
      • set up the Coalitions to all true.
      • countpivots
      • the continue to banzcomp as usual.
  • DONE if mwc = 0, then error
    • right now it fails on an assert, make it work a bit better?
    • Now exits with a message to stderr, and an appropriate status code.

compiler

Compiler-Name: GNU D Vendor: gnu Vendor-Version: 2.76 D-Version: 2