Ugh, Election

While I’m happy that a raft of shitty Conservative legislation dies on the floor today (copyright reform bill C-61 included), I’m not entirely thrilled at the prospect an election.

Rather than ranting, I thought it might be useful to outline my algorithm for choosing a candidate to vote for. It’s hand-tweaked, but it has served me well for a few elections now. It goes something like this:

def vote(Candidates):

    voteFor = nobody

    # If there are any super-awesome candidates,
    # vote for the best one.

    for candidate in Candidates:

        if isSuperAwesome(candidate):
            if candidate > voteFor:
                voteFor = candidate

    if voteFor != nobody:
        return voteFor


    # Otherwise, run through the list of parties in
    # order or personal preference, excluding
    # Conservatives.

    for party in ['Liberal', 'Green', 'NDP']:

        if not totallySucks(Candidates[party]):
            return Candidates[party]

    # Otherwise, stay home.
    # TODO: should I have a fall-back to vote for
    # a mediocre indepentant?  Not that it matters
    # at this point...

    return nobody

If you can’t read Python, I apologize. Just read the comments (the bits after the #s) and you should be okay.

I have reasons for all the decision points, but I think, if you’ve been following long enough, you may already have a decent idea what they are. I like to think I follow a healthy mix of strategic voting and ideology. And I won’t vote for a candidate that totally sucks on principle, no matter what their party affiliation is.

I’ll make myself go through the candidates and talk about them at some point in the next month and a bit.

4 thoughts on “Ugh, Election

  1. Matt

    Awesome!

    Python!

    Vote for Guido!

    Oddly, I had a hockey pool picker that worked much the same way (except I had a lot less invested in both time and interest)…

    import random

    data = [“Team 1”, “Team 2”]

    print random.choice(data)

    (There was a version that let me feed in a series of tuples to the list for big picks… I even did a Ruby version for kicks…)

    My Python script was dead wrong until I started inverting the results… then it was dead on.

    (Worth keeping in mind re: your election script… Though Python might be better with politics than sports…)

  2. tinkerer

    Nah, you’re obviously the engineer/math/nerdy type. Everyone knows you guys can’t spell. ;>

    Which doesn’t at all explain why I got it wrong, too! IndepenDEnt.

    Bah.

    (Spell check! It has ruined us ALL!)

Comments are closed.