Navigation

    Voting Theory Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. rob
    • Profile
    • Following 3
    • Followers 2
    • Topics 41
    • Posts 484
    • Best 112
    • Groups 1

    rob

    @rob

    Hi! I'm the one who suggested that we do this forum in nodebb, who suggested we hold a vote for the domain, suggested the domain name votingtheory, and when it won the but the people in power didn't like the results and tried change the outcome, said hell no you won't. I think I made some enemies in the process. Oops! But the national events that have happened since underscore my passion on the issue of respecting the outcome of an election (especially when it is a forum about voting).

    I am a long time javascript developer, and hope to see voting widget plug ins here, developed by members of the forum. I'll get involved if this forum gains some traction. I did a bunch of codepen work at the old forum, and would love to see this forum have the codepen plug in installed.

    132
    Reputation
    41
    Profile views
    484
    Posts
    2
    Followers
    3
    Following
    Joined Last Online
    Website pianop.ly/portfolio Location san francisco

    rob Unfollow Follow
    administrators

    Best posts made by rob

    • FairVote’s odd position against Condorcet-compliant RCV

      Let me start with a couple of premises/assertions.

      1. Infighting within the voting reform community stands in the way of wider adoption of alternative voting.

      2. If FairVote accepted a Condorcet-compliant version of Ranked Choice as an option, they would make a lot faster progress in replacing “Choose-one” voting, because they would eliminate a large amount of resistance from the voting reform community, without bothering RCV advocates in the least.

      Most people agree that if a candidate would beat every other candidate if they ran against them one-on-one, that candidate should be elected. Some people think this should outweigh everything else, while some don’t.

      FairVote has a very odd, and seemingly contradictory, position on all of this. My own reaction to their position is: “is that SERIOUSLY the hill you want to die on?” It really makes no sense at all that they are so uncompromising on this issue that would make a trivially tiny difference in actual outcomes of elections (and therefore campaign strategies), but would make a huge difference in reducing the number of people out there arguing against IRV rather than more productively directing their energy against Choose-one.

      First, let’s clarify a couple things. When I say “IRV”, I mean the current ranked-ballot system that FairVote advocates, which is also known as Hare. You can call it RCV-Hare. In many contexts, “Ranked Choice” or “RCV” simply refer to his method, but here we have to be careful because Ranked Choice can apply to various Condorcet methods with ranked ballots.

      Another method, "Bottom Two runoff" is very similar to Hare in almost all ways. Being a ranked ballot system, it could easily be referred to as Ranked Choice (or even IRV, for that matter.... but here let's assume IRV specifically refers to the Hare version). Bottom Two just has a minor tweak making it Condorcet compliant. FairVote could offer it as an option, and I’d predict it would meet with near zero resistance from outside their organization.

      FairVote, though, has refused to do this, and they have been entirely contradictory regarding their reasons. They say, over and over on their site, that IRV is good because it almost always elects the Condorcet candidate (339 out of 340 elections). They say, over and over on their site, that IRV is good because it reduces polarization.

      But then, when asked why they aren’t ok with Bottom two runoff, they say “IRV rewards those w/ strong 1st choice support. Bottom-2 rewards those who avoid polarizing stances. We like IRV since it encourages real stances, not just campaigning to avoid the bottom”

      Let’s break this down, and show just how contradictory they are.

      “IRV rewards those w/ strong 1st choice support.”

      Isn’t that precisely what Choose-one, the main system they are against, does? So they are basically saying, “Rewarding first choice is the cause of all problems, and our system fixes those problems. But it still rewards first choice, and that’s good.” What?

      “Bottom-2 rewards those who avoid polarizing stances.”

      Isn’t that just another way of saying that Bottom-two runoff doesn’t encourage polarization? And yet their site is chock full of arguments that polarization is a bad thing, and IRV reduces polarization. So, again.... what?

      “We like IRV since it encourages real stances”

      I’m not really sure what qualifies as a “real stance”. Do they mean an extreme stance? A polarized stance? A one-sided stance that appeals to some faction while angering the others? One that fails to find the nuance, fails to find a middle ground?

      They really need to clarify this. I have a hard time seeing how they can clarify the meaning of "real stance," without just saying that polarization is a positive (despite all the places they say that polarization is a negative).

      To me this sounds like the exact opposite of what they say is positive in just about every other page of their web site.

      “not just campaigning to avoid the bottom”

      “Just” campaigning to avoid the bottom? “Just”? Are they really suggesting that by changing the method to bottom-2, which would have only changed the outcome in 1 out of 440 elections, that it will change campaign strategy that much, so that candidates will now have a sole priority that is completely different from what it would be with the other method? That's pretty extreme..

      The logic behind what they are saying is utterly ridiculous. FairVote is well aware that the one RCV election that didn’t elect the Condorcet winner (Burlington 2009) is the one that has produced by far the most criticism for RCV. While I am fully of the opinion that that election was a very close race, and it wasn’t THAT big an error in the grand scheme of things…. I can’t see any reasonable argument that it picked the “right” winner.

      The most charitable interpretation of what the are saying is, we want to reduce the polarization and "favor first choice only" attributes of Choose-one, but EVER SO SLIGHTLY less than we could. Because .... uhhh.... just because.

      Finally, the overall irony: FairVote says that RCV encourages compromise, nuance, and give-and-take. Accepting Bottom-Two runoff as a reasonable option would be a perfect way to practice what they preach.

      Here are some articles where FairVote argues FOR Condorcet and/or AGAINST polarization:

      https://www.fairvote.org/want_to_fix_our_polarized_politics_fix_how_we_vote

      https://www.fairvote.org/polarization_key_facts

      https://www.fairvote.org/report_finds_lack_of_competition_increased_polarization_in_congressional_elections

      https://www.fairvote.org/polarization_under_rcv_in_cambridge

      https://www.fairvote.org/every_rcv_election_in_the_bay_area_so_far_has_produced_condorcet_winners

      posted in Single-winner
      rob
      rob
    • RE: Way too many categories

      If it was up to me, if you go to the main domain page, it would route you to the recent topics page, and on that page (and all the forum pages) there would be links to other parts of the forum as well as to such things as the archives page.

      This would probably make it a lot more googlable as well as just making it easier on new visitors. The intro page is not inviting, and the page you get to when you click through to the forums is even less so.

      Now that the forum has been running for a while and is stable (good job, @Jack-Waugh ) we should be putting some effort into design / user experience and making it more search engine friendly.

      There's a whole ton of other things we could be doing (unlike reddit's EndFPTP and election method email list, we have a lot of capabilities neither of them have), but this design/ux stuff is pretty critical if we want more activity (and therefore have any impact whatsoever beyond amusing ourselves talking about stuff).

      posted in Meta/Forum Business
      rob
      rob
    • RE: Terms for Specific Voting Systems

      @toby-pereira said in Terms for Specific Voting Systems:

      Does anyone call it choose-one outside of voting geekery?

      I don't know if the general public has a well-known name for FPTP/plurality/choose-one ... even "first past the post" seems to be restricted to voting geekery. Honestly, I think most of the general public in the US just calls it "voting". Or maybe "regular voting" or "normal voting."

      But I know that "choose one" seems to be instantly understood without explanation (especially in contrast with ranked choice, which most people have heard of). I consider it a descriptive term rather than a name per se, similar to "ranked choice".

      If I say "first past the post" they have no idea what I am talking about, and it always feels awkward that I then have to say "it just means first to cross the finish line, as in horse racing, but don't bother trying to think about how that metaphor applies, because I haven't figured that out myself, but that is just what people call it."

      It always seems a distracting side conversation that is avoided if you just say "choose-one voting, which is the common system where you just pick a single candidate and the one with the most votes wins." Nobody stops to asks for an explanation--- "choose one" does the trick of getting the point across.

      posted in Advocacy
      rob
      rob
    • RE: We should probably have a status update at some point

      @cfrank said in We should probably have a status update at some point:

      The tabulation method cannot be centrally controlled as long as the votes are public. The only thing I want the council to possibly do is make an effort to verify, organize and present the results. We do definitely want a way to organize and separately analyze different groups of ballots.

      I hear ya, I'd just hope that could all happen transparently in the forum threads. Any results I posted would link to something like this, where people can paste in ballots, analyze the code, fork the code, etc, so any forum user could check my work (and if they wantm retabulate them in different methods or filtering voters by origin, etc). https://codepen.io/karmatics/pen/ExKZVjM

      I mean, I don't care if council members want to come in and verify them, but I honestly doubt they'd want to do it as anything other than regular forum participants. This stuff just seems to lend itself to forums

      I could see this leading to something more official.... built in widgets and visualizers, pinned threads, permanent pages, etc, and in that case it makes some sense for the council to be able to approve things, but let's just see how this goes first.

      Hopefully if the council does meet soon, they can concentrate on the issues such as entry point, categories/tags, etc... changes that @Jack-Waugh will need to make and I think he wants others to make the decisions before doing so.

      posted in Forum Council Meetings and Agendas
      rob
      rob
    • RE: Are Equal-ranking Condorcet Systems susceptible to Duverger’s law?

      @cfrank Note that one definition of "Act of Congress" is:

      (idiomatic, US, chiefly colloquial) Authorization that is extremely difficult to get, especially in a timely fashion.
      Does it take an act of Congress just to get a stop sign on a corner?

      But yeah, PR is fine as long as it isn't party-list based, which really rubs me the wrong way. I like more general solutions. One thing I like about about single winner is you can learn about it and use it for voting for all kinds of things that aren't political.

      Most of the stuff that talks about PR comes off to me as people are grasping at straws to use black-and-white logic to describe things that intrinsically lie on a spectrum. Like, you don't have "representation" unless "your party" has a member in there. To someone who considers themselves an independent, that simply doesn't compute.

      posted in Voting Theoretic Criteria
      rob
      rob
    • RE: Way too many categories

      @andy-dienes I agree, but I just go to the "recent" link at top, which is the little clock. It allows me to completely ignore categories.

      I would prefer that be the default page, which would especially make it friendlier for newcomers.

      Narrowing the categories down to the ones you suggest would be a big improvement though.

      posted in Meta/Forum Business
      rob
      rob
    • RE: New Simple Condorcet Method - Basically Copeland+Margins

      @sass Yes that gets to the point quickly. I like.

      This seems similar in spirit to the one I was proposing recently. The main difference is that mine used cardinal ballots (intended to be identical to STAR ballots, such as if the STAR people might want to offer a Condorcet version of STAR). But otherwise it was like yours in that it ran pairwise matchups first, and if there was a tie, fell back on the simplest way to resolve it.

      So your single sentence could change one word and describe mine:

      Among the candidates who tie for winning the most head-to-head matchups, elect the candidate with the best average score.

      https://www.votingtheory.org/forum/topic/130/star-like-method-reverse-star

      That said, I think yours makes more sense for pitching it to Yang's crew, since they seem to like ranked ballots.

      posted in New Voting Methods and Variations
      rob
      rob
    • What are the strategic downsides of a state using a non-FPTP method for presidential elections?

      Maine used ranked choice voting in the last presidential election, the first state to do so:
      https://www.themainewire.com/2020/09/maines-high-court-rules-rcv-must-be-used-in-presidential-election/

      I'd love to see other states follow suit (whether with ranked choice, approval, or whatever) but I'm concerned that most states wouldn't do it because they are likely to conclude that it is against the interests of the majority of the voters of the state.

      I don't know if I have this right, so I am curious if others see a flaw in my logic.

      If there are really only two main candidates in the general election, it shouldn't matter if it is FPTP or not. But let's say there is a third candidate that is popular and had wide appeal, drawing voters from each major party candidate. In other words, a candidate that could actually win under a "good" voting system.

      The last I remember this happening was Ross Perot. In June before the election, he was the front runner, with 37% favorability compared to 24% for both Bill Clinton or Bush Sr. So a whole lot of people liked Perot most, but ultimately were discouraged from voting for him because they didn't think he'd be a front runner. Instead they strategically voted for either Bush or Clinton.

      Perot got 19% of the votes, but of zero electoral votes since those 19% were spread pretty evenly across the country. In some states he came did come in second place, one of them actually being Maine, where he barely edged out Bush.

      Now, imagine a state like Maine having RCV in that election. In that case, Perot might well have won Maine's electoral votes, if people ranked their choices sincerely. He would have a lot of first choice votes, but also have a lot more second choice votes than other candidates (since he was seen as more of a centrist). In fact, Perot got more votes than Bush in Maine under FPTP, so I'd say it is extremely likely he would have won under RCV.

      But what that would do is result in Maine give their electoral votes to Perot, while the front runners nationwide were Bush and Clinton. Since the majority of Maine voters preferred Clinton to Bush, having RCV would have very likely caused their electoral votes to be wasted, rather than casting them for Maine's preference between the front runners.

      Am I missing something here? And if I am right, is there any better way to implement a better voting system in a single state, when the rest of the country is using the old one?

      posted in Voting Methods
      rob
      rob
    • RE: Sensible Rules for Recall Elections

      @Marylander said in Sensible Rules for Recall Elections:

      However, the simplest solution would be to simply hold another election where the governor and potential replacements are all just treated as candidates, as they would be in an ordinary election.

      Agree, although I think it should also require any candidate that replaces the governor to beat the governor by a certain amount. The low threshold for ousting someone who has been elected doesn't make sense. California's system is severely broken, and was a huge expense that was completely unnecessary.

      Although, in the end, Newsome and Democrats probably benefitted from it this time around.

      posted in Single-winner
      rob
      rob
    • RE: Being "non-partisan" (and "conflict of interest" statements)

      @robla I've always considered that voting theory is a "meta-politics" discussion, and discussing plain-old politics in this context (including just declaring yourself to be on one one side or another) is pretty much the same as discussing it at family Thanksgiving dinner. In that, if you aren't 100% sure everyone agrees with your general position, no good can result from bringing it up and a lot of harm can. All it does is divide people who otherwise can be pursuing a common purpose (whether it being hanging out with family and enjoying good food, or helping navigate the world toward better voting systems)

      I also don't look at whatever side I tend to vote with as my "team." It's not just that I have a mind of my own (and I really hate being pigeonholed), but if I want to join a "team," it is the anti-team team. I am in firm agreement with George Washington's Farewell Address sentiments, when he expresses his concerns about factionalism.

      https://en.wikipedia.org/wiki/George_Washington's_Farewell_Address#Political_parties

      It's worth reading the address itself, specifically this part, which is pretty freaking prescient:

      the common and continual mischiefs of the spirit of party are sufficient to make it the interest and duty of a wise people to discourage and restrain it. .... It agitates the Community with ill-founded jealousies and false alarms; kindles the animosity of one part against another, foments occasionally riot and insurrection.

      https://en.wikisource.org/wiki/Washington's_Farewell_Address

      Maybe I am misinterpreting what you are asking here, but I just don't think this is the place to wear ones politics on their sleeves, and I have always gone out of my way to do the opposite.

      On the other hand I have encouraged people to state their preferences as far as voting methods (you'll see mine in my signature), and I think that's useful. I am not shy about my agenda here, which to help reduce the divisiveness in government and the general public, by eliminating choose-one voting. My strategy is to promote Condorcet-compliant methods, while acknowledging that RCV-Hare is a big step in the right direction, even if it doesn't get us quite as far as Condorcet methods do. I also acknowledge that other methods such as STAR and Approval are much better than choose-one, and while I won't bash them, I am concerned that they don't seem likely to make a lot of inroads.

      posted in Meta/Forum Business
      rob
      rob

    Latest posts made by rob

    • RE: Me again...

      @mosbrooker said in Me again...:

      laws that censor dangerous people (Ron DeSantis) from harming people (the entire LGBTQ community).

      I'm on your side (....?), but still I think this is more political than I recommend for this group. Not everyone agrees on whether the person you mention is harmful. He's currently a fairly likely to win (25% or so, according to prediction markets) the us presidential election.

      And I'm not necessarily on your side in terms of thinking we should "censor" such people.... censure, maybe.

      Democracy can actually put divisive figures into power if it is to "run its course", unless that democracy is specifically designed to not do so. That's why I stay interested in this topic, the ability to shape the democracy so it actually works. There is no one best way, but some are certainly better than others. Some systems, such as the "first past the post"/"plurality" one that is so common in the US, actually drive people apart. Unfortunately, a lot of people think the word democracy means plurality. (although they often mislabel it "majority")

      But it does seem rather weird to say "let democracy run its course", while also saying "we need laws that censor dangerous people". Who is going to put those laws in place? Elected people? But clearly our democracy will elect people who don't agree with your idea of what a dangerous person is (while claiming that all kinds of things that you probably support are dangerous)

      posted in Voting Method Discussion
      rob
      rob
    • RE: STAR-like method ("reverse STAR"?)

      @jack-waugh yeah I started to reply there but it has a weird registration process that annoyed me. (it had a "register and post" button, but then complained I wasn't registered when I tried to use it). Also just an old site that looks like it's hardly used anymore. So I didn't bother.

      Feel free to direct him here if you want to. (not that there's been a lot of activity here either)

      posted in Single-winner
      rob
      rob
    • RE: STAR-like method ("reverse STAR"?)

      @jack-waugh He doesn't seem to understand the basics.

      He says "it seems quite likely that Condorcet scoring would only result in the continuation of two-party politics," but doesn't really give any reason for coming to this conclusion.

      He previously noted "Consider that in a contest between only two candidates, it is unclear what advantage Condorcet voting might have, even over plurality voting." Well, yeah, of course. If only 2 candidates, making it ranked or Condorcet or anything else won't improve it.

      But the point is that, under a better system (which could be this one, IRV, Approval, STAR, or whatever), the incentives change, especially in the long term. People more in the middle have far more incentive to run. There is less incentive to eliminate similar candidates via primaries or other party nomination mechanisms. Meaning it is far more likely to have more than two viable candidates.

      Parties, and especially the two major parties, will remain an important force in political elections as long as there are plurality elections. Even if the current election is done via Condorcet, you can't 100% escape the influence of parties that are mostly incentivized due to the plurality elections that are still happening. But the more you have Condorcet elections (or STAR or IRV or whatever), the less the influence by the major two parties will be.

      I believe this "vote splitting resistant" effect is strongest on Condorcet methods, but it is true for all of the above methods. If he doesn't understand how this would reduce two-party domination, I would suggest he needs to do some reading before he give hot-takes.

      posted in Single-winner
      rob
      rob
    • RE: Ballot Types in Simulation

      BTW, you mentioned how equal ranks are done:

      a=b>e>c=d

      becomes:

      {
       ranks: [
         ["a", "b"], 
         ["e"],
         ["c", "d"]
       ]
      }
      

      Another option might be:

      {
       ranks: [
         "a=b", 
         "e",
         "c=d"
       ]
      }
      

      This simplifies the default case of no equal ranks, but allows a simple operation ( item.split('=') ) to get them into a list if needed.

      posted in Simulations
      rob
      rob
    • RE: Ballot Types in Simulation

      @jack-waugh Sorry that Codepen doesn't tabulate, I must have been working on it and broken something. This one does, and is just a previous fork:

      https://codepen.io/karmatics/pen/gOrLLxP

      I did test it with numerical "names" for candidates so this works:

      134: 0[5] 1[4] 2[2] 3[1] 4[0] 5[0]
      64: 0[5] 1[4] 2[3] 3[1] 4[0] 5[0]
      94: 0[3] 1[5] 2[4] 3[1] 4[0] 5[0]
      70: 0[2] 1[2] 2[5] 3[2] 4[0] 5[0]
      63: 0[0] 1[0] 2[0] 3[3] 4[4] 5[5]
      55: 0[0] 1[0] 2[1] 3[3] 4[5] 5[4]
      55: 0[0] 1[1] 2[4] 3[3] 4[5] 5[3]
      48: 0[0] 1[0] 2[5] 3[3] 4[5] 5[5]
      30: 0[1] 1[0] 2[1] 3[3] 4[3] 5[5]
      30: 0[0] 1[1] 2[2] 3[5] 4[5] 5[4]
      28: 0[2] 1[1] 2[0] 3[3] 4[3] 5[5]
      27: 0[0] 1[0] 2[0] 3[3] 4[5] 5[5]
      26: 0[0] 1[1] 2[3] 3[3] 4[5] 5[3]
      22: 0[1] 1[0] 2[0] 3[3] 4[4] 5[5]
      20: 0[1] 1[1] 2[0] 3[3] 4[3] 5[5]

      They are treated as strings by the tabulation logic, but you don't have to.

      Also, notice this codepen, where it does rankings (but I don't know if it handles equal rankings, it probably will parse them but simply use the first member of each subarray, since I was using it on real election data from the infamous Burlington election.

      https://codepen.io/karmatics/pen/PoRvYaX

      Also notice how it uses single characters for the candidate "names" (to keep the data really small), but those are simply keys into a list (a.k.a. hash table) of full names. Keep in mind that hash lookup is ridiculously fast in Javascript, in case you were doing indexes into an array as an optimization. The latter is probably no faster.

      a: Kiss
      b: Montroll
      c: Simpson
      d: Smith
      e: Wright
      f: w-i
      ------------
      840:e
      355:a>b
      326:a
      271:e>d
      256:e>b
      234:a>b>d
      200:b>a
      178:b
      147:e>b>d
      145:b>a>d
      139:b>d
      125:a>d
      124:d
      
      posted in Simulations
      rob
      rob
    • RE: Ballot Types in Simulation

      @jack-waugh Not sure "name" is the right word for what I identify candidates by, since you can just use a one character string, which in turn maps back to the full name. (in which case "key" might be a better word for it) But it also allows you use a full name. I aimed for flexibility.

      I haven't looked at the code for a while, but you could probably use numbers as keys. The problem with that is it might confuse it unless you add a bit of logic to make it smarter.

      Regardless I preferred by able to do both this:

      a[5] c[4]

      and this

      Joe Smith[5] Jane Jones[4]

      As for arrays when you have equal ranking, how else could you do it? You have to be able to have multiple members at each ranking. I'm not sure the best solution, but that is what I came up with. I don't think I did much if anything in terms of tabulating ranked ballots, mostly I did cardinal ballots.... I'm open to suggestions.

      posted in Simulations
      rob
      rob
    • RE: Ballot Types in Simulation

      @jack-waugh said in Ballot Types in Simulation:

      At the moment, external notation is not an immediate concern for me

      Ok, I mean, usually I like for things to be viewable by humans. But also, this does go beyond external notation because it parses them into a form that is usable by the program. It also makes the distinction you note between ballot types and tabulation methods.

      Obviously its up to you to do it how you see best, but since you keep posting here your thoughts as you build things out, presumably so others can weigh in, this is me weighing in: I think having it able to import and export to a human readable, human editable format should typically be a first step on a project like this. If only to do regular sanity checks as you build things out.

      Is there something else you are looking for?

      posted in Simulations
      rob
      rob
    • RE: Code Readability

      @jack-waugh said in Code Readability:

      That technique obscures what is dependent on what

      Yeah, for stuff like that, I wait until a project becomes bigger to worry about it. It's easy to change it later if you need to be more rigorous about such things. For whatever it is worth, my suggestion is to relax a bit on such things, it might result in getting things working more quickly.

      @jack-waugh said in Code Readability:

      I had moved away from app-specific HTML for so long that I sort of forgot that you can load everything as scripts from the HTML.

      I also do a fair amount of loading stuff this way. That is, load the script files dynamically. Can be really handy if you want to load an updated version of some code without restarting the whole app. This is a bit more complicated because it allows loading directly from a file (via src property of a script tag), or actually reading the text of the js file, and inserting that into a script tag.

      (I wouldn't leave it this way on any kind of production app, but it is handy while building something out)

      let loadAllJavascript = (isReload) => {
          var filteredPath = 'http://localhost:9999/js/filtered/';
          // third item true to pull from sandbox files instead
          var files = [
            ['ElemMaker', 'http://localhost:9999/js/library/', true],
            ['PopupBox', filteredPath, true],
            ['Scrubber', filteredPath, true],
            ['AccurateYoutubeTime', filteredPath, true],
            ['SynchronizerThread', filteredPath, true],
            ['VideoEventScheduler', filteredPath, true],
            ['VideoEventQueue', filteredPath, true],
            ['VideoPlayerNew', filteredPath, true]
          ];
      
          for(var i=0; i<files.length; i++) {
            let scr = document.createElement('script');
            if(files[i][2]) {
              if(!isReload) {
              // this (fetching the text then applying it
              // to script tag, rather than just setting the source
              // url) should not be necessary, but it seems to be
              // in this sandbox environment   .
              fetch('./js/' + files[i][0] + '.js?' + Math.random())
                .then((response) => {
                  if (response.ok) return response.text()
                  throw new Error('Network response was not ok.')
                })
                .then((data) => {
                  let scr = document.createElement('script');
                  scr.appendChild(document.createTextNode(data))   
                  document.body.appendChild(scr);
                });
              }
            } else {
              scr.src =  files[i][1] + files[i][0] + '.js?' + Math.random();
              document.body.appendChild(scr);
            }
          }
        }
      
      posted in Issue Reports
      rob
      rob
    • RE: Ballot Types in Simulation

      I hope you look at the Codepen where I parse and stringify a bunch of different ballot types: https://codepen.io/karmatics/pen/poLPpzW

      It's a bit tricky because it does its best to infer ballot type and put them all into a reasonable object structure, also allowing you do condense them (if the line starts with "134:" that means 134 ballots identical to this one) as well as expand them back.

      I try to use formats that also work on forums, so they are very human readable.

      So:

      134: a[5] b[4] c[2] d[1] e[0] f[0]
      64: a[5] b[4] c[3] d[1] e[0] f[0]
      94: a[3] b[5] c[4] d[1] e[0] f[0]
      70: a[2] b[2] c[5] d[2] e[0] f[0]
      63: a[0] b[0] c[0] d[3] e[4] f[5]
      55: a[0] b[0] c[1] d[3] e[5] f[4]
      55: a[0] b[1] c[4] d[3] e[5] f[3]
      48: a[0] b[0] c[5] d[3] e[5] f[5]

      Candidate names don't have to be single letters and can have spaces. If no number at the beginning, it will be interpreted as "1:" Floating point is allowed.

      You might also using name mapping, so you could have a long name i.e. "Robert J. Brown" which maps to a short name "rb" for more compact representation.

      You can do ranked like this:

      5: d>b>e>c
      2: d>b
      e>f>g

      And equal rankings can be in there as

      d>b=c>a

      (there should probably be a flag for whether this is allowed, same goes for lots of things, like floating point scores)

      And of course approval:

      b,c
      c
      d,e

      Anyway, not sure the degree you are interested in using code that isn't yours, but all I'm saying is that a lot of work has been done and is free to use.

      posted in Simulations
      rob
      rob
    • RE: Code Readability

      @jack-waugh said in Code Readability:

      Sounds as though you are using some bundler that packages up your .js files and includes them in the HTML served.

      No. I've done things like that, when needed, but for simple projects there is no need.

      All that is needed is:

      <script src='Blah.js'></script>
      <script>
      Blah.sayHello();
      </script>
      

      where (again) Blah.js has the code like this:

      Blah = {
        sayHello: () => {
           console.log('hello world');
         }
      };
      

      Blah is created as a global variable. I typically have one global per file. You could write it as window.Blah (which makes it more obvious it is a global in browser-space), or precede it with "var", but I often skip both of those for a clean appearance. I use upper case to make it clear that it is a global.

      If I start getting worried about variable name collisions and such, then the project must have gotten huge.

      I've done it sometimes like this when I worry about clashing with other variables when working in someone else's big messy app:

      // create global "g" if it doesn't already exist 
      window.g = window.g || {};
      
      g.Blah = {
        sayHello: () => {
           console.log('hello world');
         }
      };
      

      And for completeness, I should add that sometimes I want a js file to run both client and server, so I might do something like this (which is admittedly a bit messier looking, but not a big deal):

      { 
      
        let blah = {
          sayHello: () => {
             console.log('hello world');
           }
        };
      
        if(typeof window === 'undefined') {
          module.exports = blah; // node.js, export it
        } else {
          window.Blah = blah; // browser, make a global
        }
      
      }
      
      posted in Issue Reports
      rob
      rob